<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>2小时躲坑k8s-大型分布式集群环境捷径部署 | AJ</title>
    <meta name="generator" content="VuePress 1.5.0">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <script>
            var _hmt = _hmt || [];
            (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?51b8c2e72d1adf96524638ce85bb7d72";
            var s = document.getElementsByTagName("script")[0]; 
            s.parentNode.insertBefore(hm, s);

            // 引入谷歌,不需要可删除这段
            var hm1 = document.createElement("script");
            hm1.src = "https://www.googletagmanager.com/gtag/js?id=G-B7351EYS04";
            var s1 = document.getElementsByTagName("script")[0]; 
            s1.parentNode.insertBefore(hm1, s1);
            })();

            // 谷歌加载,不需要可删除
            window.dataLayer = window.dataLayer || [];
            function gtag(){dataLayer.push(arguments);}
            gtag('js', new Date());

            gtag('config', 'G-B7351EYS04');
        </script>
    <meta name="description" content="阿俊博客|记录一个程序员的成长历程 阿俊博客(blog.zhequtao.com)记录一个后端程序员的成长历程,分享他的学习笔记和心得,还有些开发必备技巧哦! java golang web html dev开发">
    <link rel="preload" href="/assets/css/0.styles.a3df589e.css" as="style"><link rel="preload" href="/assets/js/app.cb35c8f6.js" as="script"><link rel="preload" href="/assets/js/2.063846a6.js" as="script"><link rel="preload" href="/assets/js/4.1ffb4609.js" as="script"><link rel="preload" href="/assets/js/3.76257eb7.js" as="script"><link rel="prefetch" href="/assets/js/10.5629fe4d.js"><link rel="prefetch" href="/assets/js/100.8417ccea.js"><link rel="prefetch" href="/assets/js/101.37fdb377.js"><link rel="prefetch" href="/assets/js/102.848b686d.js"><link rel="prefetch" href="/assets/js/103.6a2489a0.js"><link rel="prefetch" href="/assets/js/104.99e8899f.js"><link rel="prefetch" href="/assets/js/105.8b741763.js"><link rel="prefetch" href="/assets/js/106.08163715.js"><link rel="prefetch" href="/assets/js/107.21801349.js"><link rel="prefetch" href="/assets/js/108.e3a2892b.js"><link rel="prefetch" href="/assets/js/109.dab5618c.js"><link rel="prefetch" href="/assets/js/11.cddc1623.js"><link rel="prefetch" href="/assets/js/110.f5249b39.js"><link rel="prefetch" href="/assets/js/111.9abf8bce.js"><link rel="prefetch" href="/assets/js/112.8eb86924.js"><link rel="prefetch" href="/assets/js/113.c180ed46.js"><link rel="prefetch" href="/assets/js/114.2370f5b5.js"><link rel="prefetch" href="/assets/js/115.88dc3fd8.js"><link rel="prefetch" href="/assets/js/116.63403600.js"><link rel="prefetch" href="/assets/js/117.83674aa0.js"><link rel="prefetch" href="/assets/js/118.9c58c685.js"><link rel="prefetch" href="/assets/js/119.621f9a70.js"><link rel="prefetch" href="/assets/js/12.ff3d03f5.js"><link rel="prefetch" href="/assets/js/120.a6d2b7f7.js"><link rel="prefetch" href="/assets/js/121.ae0ce9d1.js"><link rel="prefetch" href="/assets/js/122.de240e6d.js"><link rel="prefetch" href="/assets/js/123.b043e3e4.js"><link rel="prefetch" href="/assets/js/124.550af937.js"><link rel="prefetch" href="/assets/js/125.6f06b34c.js"><link rel="prefetch" href="/assets/js/126.38d64604.js"><link rel="prefetch" href="/assets/js/127.a948db56.js"><link rel="prefetch" href="/assets/js/128.4ca789e0.js"><link rel="prefetch" href="/assets/js/129.59be4505.js"><link rel="prefetch" href="/assets/js/13.e9f75cc3.js"><link rel="prefetch" href="/assets/js/130.ddae76a9.js"><link rel="prefetch" href="/assets/js/131.d969c265.js"><link rel="prefetch" href="/assets/js/132.5f43ce5c.js"><link rel="prefetch" href="/assets/js/133.b651af22.js"><link rel="prefetch" href="/assets/js/134.2499236a.js"><link rel="prefetch" href="/assets/js/135.4180596c.js"><link rel="prefetch" href="/assets/js/136.2c309233.js"><link rel="prefetch" href="/assets/js/137.72ca42dd.js"><link rel="prefetch" href="/assets/js/138.3772cd38.js"><link rel="prefetch" href="/assets/js/139.1d0a53da.js"><link rel="prefetch" href="/assets/js/14.be4b89ed.js"><link rel="prefetch" href="/assets/js/140.22368353.js"><link rel="prefetch" href="/assets/js/141.a14aef3c.js"><link rel="prefetch" href="/assets/js/142.2041ce3a.js"><link rel="prefetch" href="/assets/js/143.377262ec.js"><link rel="prefetch" href="/assets/js/144.8fcbc368.js"><link rel="prefetch" href="/assets/js/145.46da36bf.js"><link rel="prefetch" href="/assets/js/146.eceae0d9.js"><link rel="prefetch" href="/assets/js/147.e1bd6531.js"><link rel="prefetch" href="/assets/js/148.76f193ce.js"><link rel="prefetch" href="/assets/js/149.587bd581.js"><link rel="prefetch" href="/assets/js/15.e3219ac0.js"><link rel="prefetch" href="/assets/js/150.169c71e0.js"><link rel="prefetch" href="/assets/js/151.384021ea.js"><link rel="prefetch" href="/assets/js/152.0f20cf03.js"><link rel="prefetch" href="/assets/js/153.fd94af1e.js"><link rel="prefetch" href="/assets/js/154.a550f5dc.js"><link rel="prefetch" href="/assets/js/155.ba1ae86e.js"><link rel="prefetch" href="/assets/js/156.3b98ded0.js"><link rel="prefetch" href="/assets/js/157.cd378596.js"><link rel="prefetch" href="/assets/js/158.c138d0df.js"><link rel="prefetch" href="/assets/js/159.2635f7f4.js"><link rel="prefetch" href="/assets/js/16.c9c35d42.js"><link rel="prefetch" href="/assets/js/160.d51b4126.js"><link rel="prefetch" href="/assets/js/161.5dc29e7b.js"><link rel="prefetch" href="/assets/js/162.f257a92b.js"><link rel="prefetch" href="/assets/js/163.9eb75e40.js"><link rel="prefetch" href="/assets/js/164.8fb1e22b.js"><link rel="prefetch" href="/assets/js/165.49255503.js"><link rel="prefetch" href="/assets/js/166.e54539e6.js"><link rel="prefetch" href="/assets/js/167.a06acdb0.js"><link rel="prefetch" href="/assets/js/168.948ab620.js"><link rel="prefetch" href="/assets/js/169.7d756812.js"><link rel="prefetch" href="/assets/js/17.81067bc8.js"><link rel="prefetch" href="/assets/js/170.ffe63330.js"><link rel="prefetch" href="/assets/js/171.835398b9.js"><link rel="prefetch" href="/assets/js/172.3987be39.js"><link rel="prefetch" href="/assets/js/173.e3cedb8a.js"><link rel="prefetch" href="/assets/js/174.11a32588.js"><link rel="prefetch" href="/assets/js/175.da6f9782.js"><link rel="prefetch" href="/assets/js/176.50e55edc.js"><link rel="prefetch" href="/assets/js/177.a89a1d17.js"><link rel="prefetch" href="/assets/js/178.7ad3ce84.js"><link rel="prefetch" href="/assets/js/179.98a1343b.js"><link rel="prefetch" href="/assets/js/18.b67caf4c.js"><link rel="prefetch" href="/assets/js/180.4e98599b.js"><link rel="prefetch" href="/assets/js/181.dd885afd.js"><link rel="prefetch" href="/assets/js/182.789990c8.js"><link rel="prefetch" href="/assets/js/183.f11ca2fd.js"><link rel="prefetch" href="/assets/js/184.fcf128ec.js"><link rel="prefetch" href="/assets/js/185.54e1e9b6.js"><link rel="prefetch" href="/assets/js/186.db91021a.js"><link rel="prefetch" href="/assets/js/187.5309dd42.js"><link rel="prefetch" href="/assets/js/188.615821ea.js"><link rel="prefetch" href="/assets/js/189.f23f1d42.js"><link rel="prefetch" href="/assets/js/19.294a011c.js"><link rel="prefetch" href="/assets/js/190.efe894bc.js"><link rel="prefetch" href="/assets/js/191.0d14904a.js"><link rel="prefetch" href="/assets/js/192.efd25a9e.js"><link rel="prefetch" href="/assets/js/193.88151f34.js"><link rel="prefetch" href="/assets/js/194.efedce14.js"><link rel="prefetch" href="/assets/js/195.03ac15bb.js"><link rel="prefetch" href="/assets/js/196.fbc18389.js"><link rel="prefetch" href="/assets/js/197.0257ab5e.js"><link rel="prefetch" href="/assets/js/198.f1de2817.js"><link rel="prefetch" href="/assets/js/199.8f1c166b.js"><link rel="prefetch" href="/assets/js/20.1a41edb1.js"><link rel="prefetch" href="/assets/js/200.4af99727.js"><link rel="prefetch" href="/assets/js/201.9f8caef1.js"><link rel="prefetch" href="/assets/js/202.6f07d705.js"><link rel="prefetch" href="/assets/js/203.5012fe50.js"><link rel="prefetch" href="/assets/js/204.3a0dfd8e.js"><link rel="prefetch" href="/assets/js/205.0ba9b606.js"><link rel="prefetch" href="/assets/js/206.663a49ec.js"><link rel="prefetch" href="/assets/js/207.b2406149.js"><link rel="prefetch" href="/assets/js/208.b0b2dfd8.js"><link rel="prefetch" href="/assets/js/209.41a0ec9f.js"><link rel="prefetch" href="/assets/js/21.b6ea6f9a.js"><link rel="prefetch" href="/assets/js/210.6f36beb8.js"><link rel="prefetch" href="/assets/js/211.90ef6e5c.js"><link rel="prefetch" href="/assets/js/212.42339063.js"><link rel="prefetch" href="/assets/js/213.a2bfeda9.js"><link rel="prefetch" href="/assets/js/214.5c7eb42a.js"><link rel="prefetch" href="/assets/js/215.18260ae5.js"><link rel="prefetch" href="/assets/js/216.7678fd29.js"><link rel="prefetch" href="/assets/js/217.9d936f88.js"><link rel="prefetch" href="/assets/js/218.bac403c4.js"><link rel="prefetch" href="/assets/js/219.9d8cb16b.js"><link rel="prefetch" href="/assets/js/22.367cc253.js"><link rel="prefetch" href="/assets/js/220.375b7707.js"><link rel="prefetch" href="/assets/js/221.3e400da4.js"><link rel="prefetch" href="/assets/js/222.8fbd2857.js"><link rel="prefetch" href="/assets/js/223.76a10075.js"><link rel="prefetch" href="/assets/js/224.ff94cc4e.js"><link rel="prefetch" href="/assets/js/225.d4688ca6.js"><link rel="prefetch" href="/assets/js/226.b13b18af.js"><link rel="prefetch" href="/assets/js/227.288d0f96.js"><link rel="prefetch" href="/assets/js/228.60430ac0.js"><link rel="prefetch" href="/assets/js/229.da728342.js"><link rel="prefetch" href="/assets/js/23.bc3de730.js"><link rel="prefetch" href="/assets/js/230.d8417d20.js"><link rel="prefetch" href="/assets/js/231.6a9ce0b4.js"><link rel="prefetch" href="/assets/js/232.7611b413.js"><link rel="prefetch" href="/assets/js/233.94712cf9.js"><link rel="prefetch" href="/assets/js/234.93888298.js"><link rel="prefetch" href="/assets/js/235.62506981.js"><link rel="prefetch" href="/assets/js/236.5a055c7c.js"><link rel="prefetch" href="/assets/js/237.0a6c4902.js"><link rel="prefetch" href="/assets/js/238.e5f37663.js"><link rel="prefetch" href="/assets/js/239.331bba86.js"><link rel="prefetch" href="/assets/js/24.82f0901c.js"><link rel="prefetch" href="/assets/js/240.59591cfc.js"><link rel="prefetch" href="/assets/js/241.ce671f47.js"><link rel="prefetch" href="/assets/js/242.fb2542fa.js"><link rel="prefetch" href="/assets/js/243.74abc73d.js"><link rel="prefetch" href="/assets/js/244.ecd707b2.js"><link rel="prefetch" href="/assets/js/245.d728367b.js"><link rel="prefetch" href="/assets/js/246.9270e7fe.js"><link rel="prefetch" href="/assets/js/247.a421ba15.js"><link rel="prefetch" href="/assets/js/248.e759132e.js"><link rel="prefetch" href="/assets/js/249.3077fb46.js"><link rel="prefetch" href="/assets/js/25.95c551dc.js"><link rel="prefetch" href="/assets/js/250.5fe4dd03.js"><link rel="prefetch" href="/assets/js/251.4b8fe76c.js"><link rel="prefetch" href="/assets/js/252.0d1cf7ea.js"><link rel="prefetch" href="/assets/js/253.89d16ba0.js"><link rel="prefetch" href="/assets/js/254.8d1afc68.js"><link rel="prefetch" href="/assets/js/255.64e680cb.js"><link rel="prefetch" href="/assets/js/256.9defbd0e.js"><link rel="prefetch" href="/assets/js/257.1fef24fd.js"><link rel="prefetch" href="/assets/js/258.4e205286.js"><link rel="prefetch" href="/assets/js/259.f3d56efc.js"><link rel="prefetch" href="/assets/js/26.7fe56bac.js"><link rel="prefetch" href="/assets/js/260.378299e6.js"><link rel="prefetch" href="/assets/js/261.8e4fb397.js"><link rel="prefetch" href="/assets/js/262.54595d98.js"><link rel="prefetch" href="/assets/js/263.fb333dc1.js"><link rel="prefetch" href="/assets/js/264.13d13301.js"><link rel="prefetch" href="/assets/js/265.c85104bc.js"><link rel="prefetch" href="/assets/js/266.9f3d1f1c.js"><link rel="prefetch" href="/assets/js/267.fb392815.js"><link rel="prefetch" href="/assets/js/268.add7eacb.js"><link rel="prefetch" href="/assets/js/269.7e49fcc7.js"><link rel="prefetch" href="/assets/js/27.5547e5f0.js"><link rel="prefetch" href="/assets/js/270.22342070.js"><link rel="prefetch" href="/assets/js/271.59917b1a.js"><link rel="prefetch" href="/assets/js/272.4a4751d5.js"><link rel="prefetch" href="/assets/js/273.f4c2fa5c.js"><link rel="prefetch" href="/assets/js/274.1208bc94.js"><link rel="prefetch" href="/assets/js/275.f6528753.js"><link rel="prefetch" href="/assets/js/276.a68772cd.js"><link rel="prefetch" href="/assets/js/277.f154ab32.js"><link rel="prefetch" href="/assets/js/278.bb616a63.js"><link rel="prefetch" href="/assets/js/279.6a356cff.js"><link rel="prefetch" href="/assets/js/28.b08b2847.js"><link rel="prefetch" href="/assets/js/280.5afc20fc.js"><link rel="prefetch" href="/assets/js/281.3cd86225.js"><link rel="prefetch" href="/assets/js/282.3ecb92aa.js"><link rel="prefetch" href="/assets/js/283.85159ea7.js"><link rel="prefetch" href="/assets/js/284.b6545c68.js"><link rel="prefetch" href="/assets/js/285.5e83ee29.js"><link rel="prefetch" href="/assets/js/286.2aad298d.js"><link rel="prefetch" href="/assets/js/287.3ca76244.js"><link rel="prefetch" href="/assets/js/288.5b17963d.js"><link rel="prefetch" href="/assets/js/289.f47a759b.js"><link rel="prefetch" href="/assets/js/29.562dbf7d.js"><link rel="prefetch" href="/assets/js/290.36b603c7.js"><link rel="prefetch" href="/assets/js/291.a9bd8951.js"><link rel="prefetch" href="/assets/js/292.dfc54f28.js"><link rel="prefetch" href="/assets/js/293.2d061212.js"><link rel="prefetch" href="/assets/js/294.6d564a9e.js"><link rel="prefetch" href="/assets/js/295.a31dd593.js"><link rel="prefetch" href="/assets/js/296.3101e5e8.js"><link rel="prefetch" href="/assets/js/297.7efde936.js"><link rel="prefetch" href="/assets/js/298.8bb3aa68.js"><link rel="prefetch" href="/assets/js/299.8b51e6bd.js"><link rel="prefetch" href="/assets/js/30.221adea2.js"><link rel="prefetch" href="/assets/js/300.62effe45.js"><link rel="prefetch" href="/assets/js/301.98c863c5.js"><link rel="prefetch" href="/assets/js/302.e3493ab2.js"><link rel="prefetch" href="/assets/js/303.800c8028.js"><link rel="prefetch" href="/assets/js/304.b6f08986.js"><link rel="prefetch" href="/assets/js/305.09af356b.js"><link rel="prefetch" href="/assets/js/306.d0d3589d.js"><link rel="prefetch" href="/assets/js/307.ee2fd249.js"><link rel="prefetch" href="/assets/js/308.f3f76368.js"><link rel="prefetch" href="/assets/js/309.d2b5ce40.js"><link rel="prefetch" href="/assets/js/31.334fc8bb.js"><link rel="prefetch" href="/assets/js/310.b4fa2feb.js"><link rel="prefetch" href="/assets/js/311.7d747ef3.js"><link rel="prefetch" href="/assets/js/312.89bdff40.js"><link rel="prefetch" href="/assets/js/313.875b82fe.js"><link rel="prefetch" href="/assets/js/314.0bbe51c4.js"><link rel="prefetch" href="/assets/js/315.cc07dbcf.js"><link rel="prefetch" href="/assets/js/316.bc72b152.js"><link rel="prefetch" href="/assets/js/317.55462812.js"><link rel="prefetch" href="/assets/js/318.a158fda0.js"><link rel="prefetch" href="/assets/js/319.b03a5bd2.js"><link rel="prefetch" href="/assets/js/32.d6826b16.js"><link rel="prefetch" href="/assets/js/320.a5bd19b0.js"><link rel="prefetch" href="/assets/js/321.4f9faaa7.js"><link rel="prefetch" href="/assets/js/322.dbd3b4fa.js"><link rel="prefetch" href="/assets/js/323.a04e2062.js"><link rel="prefetch" href="/assets/js/324.c45b46cf.js"><link rel="prefetch" href="/assets/js/325.cd1460c4.js"><link rel="prefetch" href="/assets/js/326.bd90ef85.js"><link rel="prefetch" href="/assets/js/327.8bf38ef7.js"><link rel="prefetch" href="/assets/js/328.99e9aed3.js"><link rel="prefetch" href="/assets/js/329.de0012cb.js"><link rel="prefetch" href="/assets/js/33.b1059062.js"><link rel="prefetch" href="/assets/js/330.59f11391.js"><link rel="prefetch" href="/assets/js/331.6d16a13c.js"><link rel="prefetch" href="/assets/js/332.922ca235.js"><link rel="prefetch" href="/assets/js/333.c94c3602.js"><link rel="prefetch" href="/assets/js/334.77e02010.js"><link rel="prefetch" href="/assets/js/335.1e0c4f7b.js"><link rel="prefetch" href="/assets/js/336.5675dc4f.js"><link rel="prefetch" href="/assets/js/337.bb6e11dc.js"><link rel="prefetch" href="/assets/js/338.294981e9.js"><link rel="prefetch" href="/assets/js/339.d0376372.js"><link rel="prefetch" href="/assets/js/34.0c7d5782.js"><link rel="prefetch" href="/assets/js/340.64596428.js"><link rel="prefetch" href="/assets/js/341.ec0f9409.js"><link rel="prefetch" href="/assets/js/342.7abc47c4.js"><link rel="prefetch" href="/assets/js/343.4262d486.js"><link rel="prefetch" href="/assets/js/344.8729ad8c.js"><link rel="prefetch" href="/assets/js/345.c210d888.js"><link rel="prefetch" href="/assets/js/346.6f42f7cb.js"><link rel="prefetch" href="/assets/js/347.81b41ae5.js"><link rel="prefetch" href="/assets/js/348.07eca37c.js"><link rel="prefetch" href="/assets/js/349.8019d6f3.js"><link rel="prefetch" href="/assets/js/35.ae14e37f.js"><link rel="prefetch" href="/assets/js/350.57da2e7b.js"><link rel="prefetch" href="/assets/js/351.2e99afdf.js"><link rel="prefetch" href="/assets/js/352.67dd88b7.js"><link rel="prefetch" href="/assets/js/353.15b9f624.js"><link rel="prefetch" href="/assets/js/354.a63e8432.js"><link rel="prefetch" href="/assets/js/355.bbc16ee9.js"><link rel="prefetch" href="/assets/js/356.ff63d3bb.js"><link rel="prefetch" href="/assets/js/357.4fb2d941.js"><link rel="prefetch" href="/assets/js/358.55182977.js"><link rel="prefetch" href="/assets/js/359.265c3d26.js"><link rel="prefetch" href="/assets/js/36.b9ed4cf1.js"><link rel="prefetch" href="/assets/js/360.ced80eb3.js"><link rel="prefetch" href="/assets/js/361.afe6ba84.js"><link rel="prefetch" href="/assets/js/362.c2b62518.js"><link rel="prefetch" href="/assets/js/363.0c4a4800.js"><link rel="prefetch" href="/assets/js/364.ce60291b.js"><link rel="prefetch" href="/assets/js/365.0e3a61f9.js"><link rel="prefetch" href="/assets/js/366.d53ccb03.js"><link rel="prefetch" href="/assets/js/367.689e464d.js"><link rel="prefetch" href="/assets/js/368.418c571f.js"><link rel="prefetch" href="/assets/js/369.c2fff3c8.js"><link rel="prefetch" href="/assets/js/37.a021ac57.js"><link rel="prefetch" href="/assets/js/370.a932b958.js"><link rel="prefetch" href="/assets/js/371.7d153241.js"><link rel="prefetch" href="/assets/js/372.fb9878fa.js"><link rel="prefetch" href="/assets/js/373.85772e03.js"><link rel="prefetch" href="/assets/js/374.b4a8b1b6.js"><link rel="prefetch" href="/assets/js/375.32f70596.js"><link rel="prefetch" href="/assets/js/376.a16d79a8.js"><link rel="prefetch" href="/assets/js/377.c996b7e1.js"><link rel="prefetch" href="/assets/js/378.d37d15c7.js"><link rel="prefetch" href="/assets/js/379.b81ba7dd.js"><link rel="prefetch" href="/assets/js/38.89138658.js"><link rel="prefetch" href="/assets/js/380.524c9b31.js"><link rel="prefetch" href="/assets/js/381.7ebfd6db.js"><link rel="prefetch" href="/assets/js/382.29edda0f.js"><link rel="prefetch" href="/assets/js/383.9642a212.js"><link rel="prefetch" href="/assets/js/384.086e3b42.js"><link rel="prefetch" href="/assets/js/385.a9bb46a8.js"><link rel="prefetch" href="/assets/js/386.f2561a39.js"><link rel="prefetch" href="/assets/js/387.ba9b6aaa.js"><link rel="prefetch" href="/assets/js/388.e0ace495.js"><link rel="prefetch" href="/assets/js/389.ba8c09dd.js"><link rel="prefetch" href="/assets/js/39.04f331e3.js"><link rel="prefetch" href="/assets/js/390.de1bb48b.js"><link rel="prefetch" href="/assets/js/391.7cc6edeb.js"><link rel="prefetch" href="/assets/js/392.0493a6f7.js"><link rel="prefetch" href="/assets/js/393.ba2d3e62.js"><link rel="prefetch" href="/assets/js/394.b3aa9224.js"><link rel="prefetch" href="/assets/js/395.f4df3a60.js"><link rel="prefetch" href="/assets/js/396.09644790.js"><link rel="prefetch" href="/assets/js/397.76163964.js"><link rel="prefetch" href="/assets/js/398.377fd8fc.js"><link rel="prefetch" href="/assets/js/399.39059be5.js"><link rel="prefetch" href="/assets/js/40.a21abf05.js"><link rel="prefetch" href="/assets/js/400.559a547f.js"><link rel="prefetch" href="/assets/js/401.bc6d738c.js"><link rel="prefetch" href="/assets/js/402.c504ed7b.js"><link rel="prefetch" href="/assets/js/403.77a0af9c.js"><link rel="prefetch" href="/assets/js/404.0f408cc6.js"><link rel="prefetch" href="/assets/js/405.90b0bab6.js"><link rel="prefetch" href="/assets/js/406.01b11432.js"><link rel="prefetch" href="/assets/js/407.58991ce5.js"><link rel="prefetch" href="/assets/js/408.9806278e.js"><link rel="prefetch" href="/assets/js/409.8d9b4bb3.js"><link rel="prefetch" href="/assets/js/41.6bcfc592.js"><link rel="prefetch" href="/assets/js/410.02dee620.js"><link rel="prefetch" href="/assets/js/411.3d12d3a6.js"><link rel="prefetch" href="/assets/js/412.37a62624.js"><link rel="prefetch" href="/assets/js/413.bda7ca34.js"><link rel="prefetch" href="/assets/js/414.2abb6547.js"><link rel="prefetch" href="/assets/js/415.1d271923.js"><link rel="prefetch" href="/assets/js/416.d1b11dfe.js"><link rel="prefetch" href="/assets/js/417.fcbf07ff.js"><link rel="prefetch" href="/assets/js/418.524d40ba.js"><link rel="prefetch" href="/assets/js/419.f264e463.js"><link rel="prefetch" href="/assets/js/42.ec85a270.js"><link rel="prefetch" href="/assets/js/420.8b99e60d.js"><link rel="prefetch" href="/assets/js/421.c697d876.js"><link rel="prefetch" href="/assets/js/422.4af54ae0.js"><link rel="prefetch" href="/assets/js/423.b75f24ff.js"><link rel="prefetch" href="/assets/js/424.ea80054f.js"><link rel="prefetch" href="/assets/js/425.804b48b0.js"><link rel="prefetch" href="/assets/js/426.ffed8383.js"><link rel="prefetch" href="/assets/js/427.2040bd22.js"><link rel="prefetch" href="/assets/js/428.b878fb56.js"><link rel="prefetch" href="/assets/js/429.f81fd922.js"><link rel="prefetch" href="/assets/js/43.c174449d.js"><link rel="prefetch" href="/assets/js/430.16f328ab.js"><link rel="prefetch" href="/assets/js/431.56f11924.js"><link rel="prefetch" href="/assets/js/432.e4c77710.js"><link rel="prefetch" href="/assets/js/433.29acf14b.js"><link rel="prefetch" href="/assets/js/434.33ee22fc.js"><link rel="prefetch" href="/assets/js/435.516f7600.js"><link rel="prefetch" href="/assets/js/436.28ae526a.js"><link rel="prefetch" href="/assets/js/437.b9bac473.js"><link rel="prefetch" href="/assets/js/438.711bd934.js"><link rel="prefetch" href="/assets/js/439.fe5f28bd.js"><link rel="prefetch" href="/assets/js/44.8704338b.js"><link rel="prefetch" href="/assets/js/440.b2f48747.js"><link rel="prefetch" href="/assets/js/441.4862a724.js"><link rel="prefetch" href="/assets/js/442.751f8ae7.js"><link rel="prefetch" href="/assets/js/443.9998dbe9.js"><link rel="prefetch" href="/assets/js/444.23d3f688.js"><link rel="prefetch" href="/assets/js/445.72419f35.js"><link rel="prefetch" href="/assets/js/446.21e02b7b.js"><link rel="prefetch" href="/assets/js/447.6bd039e5.js"><link rel="prefetch" href="/assets/js/448.af29ff31.js"><link rel="prefetch" href="/assets/js/449.bbdca196.js"><link rel="prefetch" href="/assets/js/45.f8a2a3b3.js"><link rel="prefetch" href="/assets/js/450.32e470b8.js"><link rel="prefetch" href="/assets/js/451.f4c8ff6a.js"><link rel="prefetch" href="/assets/js/452.c0ec8943.js"><link rel="prefetch" href="/assets/js/453.5af475c6.js"><link rel="prefetch" href="/assets/js/454.567aa6c1.js"><link rel="prefetch" href="/assets/js/455.326072d1.js"><link rel="prefetch" href="/assets/js/456.64b88847.js"><link rel="prefetch" href="/assets/js/457.61c91559.js"><link rel="prefetch" href="/assets/js/458.4f4d43d6.js"><link rel="prefetch" href="/assets/js/459.a88891cb.js"><link rel="prefetch" href="/assets/js/46.90855a0f.js"><link rel="prefetch" href="/assets/js/460.fb9e15f6.js"><link rel="prefetch" href="/assets/js/461.998a4991.js"><link rel="prefetch" href="/assets/js/462.56ecfb03.js"><link rel="prefetch" href="/assets/js/463.582cd053.js"><link rel="prefetch" href="/assets/js/464.f12a0050.js"><link rel="prefetch" href="/assets/js/465.cc3b08a8.js"><link rel="prefetch" href="/assets/js/466.ea7e4ce2.js"><link rel="prefetch" href="/assets/js/467.58700d93.js"><link rel="prefetch" href="/assets/js/468.bb9998cd.js"><link rel="prefetch" href="/assets/js/469.232d261d.js"><link rel="prefetch" href="/assets/js/47.02516d33.js"><link rel="prefetch" href="/assets/js/470.90ab2be8.js"><link rel="prefetch" href="/assets/js/471.3652fec6.js"><link rel="prefetch" href="/assets/js/472.bc7517c9.js"><link rel="prefetch" href="/assets/js/473.27b7892f.js"><link rel="prefetch" href="/assets/js/474.0d488768.js"><link rel="prefetch" href="/assets/js/475.bc33cf17.js"><link rel="prefetch" href="/assets/js/476.76ce67eb.js"><link rel="prefetch" href="/assets/js/477.a20657f6.js"><link rel="prefetch" href="/assets/js/478.8905ef26.js"><link rel="prefetch" href="/assets/js/479.23ec3dc9.js"><link rel="prefetch" href="/assets/js/48.8d38983c.js"><link rel="prefetch" href="/assets/js/480.105bf58e.js"><link rel="prefetch" href="/assets/js/481.d62a3699.js"><link rel="prefetch" href="/assets/js/482.6cb10cdb.js"><link rel="prefetch" href="/assets/js/483.15b9ef53.js"><link rel="prefetch" href="/assets/js/484.794aff9c.js"><link rel="prefetch" href="/assets/js/485.3e6ef3cb.js"><link rel="prefetch" href="/assets/js/486.fc20eb22.js"><link rel="prefetch" href="/assets/js/487.2a4f7d47.js"><link rel="prefetch" href="/assets/js/488.24ba9af5.js"><link rel="prefetch" href="/assets/js/489.d451928e.js"><link rel="prefetch" href="/assets/js/49.bd70c59c.js"><link rel="prefetch" href="/assets/js/490.d83e4fc7.js"><link rel="prefetch" href="/assets/js/491.0210a738.js"><link rel="prefetch" href="/assets/js/492.3a69cd85.js"><link rel="prefetch" href="/assets/js/493.89d2920f.js"><link rel="prefetch" href="/assets/js/494.b7d1c15e.js"><link rel="prefetch" href="/assets/js/495.7ccfe17f.js"><link rel="prefetch" href="/assets/js/496.0d6c912a.js"><link rel="prefetch" href="/assets/js/497.087ca2c6.js"><link rel="prefetch" href="/assets/js/498.f2b3c894.js"><link rel="prefetch" href="/assets/js/499.e741f312.js"><link rel="prefetch" href="/assets/js/5.405f2620.js"><link rel="prefetch" href="/assets/js/50.9df07553.js"><link rel="prefetch" href="/assets/js/500.cb9babb9.js"><link rel="prefetch" href="/assets/js/501.63a859b6.js"><link rel="prefetch" href="/assets/js/502.f346b273.js"><link rel="prefetch" href="/assets/js/503.cdcd3de3.js"><link rel="prefetch" href="/assets/js/504.e83ec450.js"><link rel="prefetch" href="/assets/js/505.95f18293.js"><link rel="prefetch" href="/assets/js/506.02060a3c.js"><link rel="prefetch" href="/assets/js/507.859d6ae4.js"><link rel="prefetch" href="/assets/js/508.9724d886.js"><link rel="prefetch" href="/assets/js/509.e17dd53e.js"><link rel="prefetch" href="/assets/js/51.3dfc6350.js"><link rel="prefetch" href="/assets/js/510.ea0c942f.js"><link rel="prefetch" href="/assets/js/511.64a7f9a8.js"><link rel="prefetch" href="/assets/js/512.6cce418a.js"><link rel="prefetch" href="/assets/js/513.ea813fe8.js"><link rel="prefetch" href="/assets/js/514.10242470.js"><link rel="prefetch" href="/assets/js/515.5308bdf6.js"><link rel="prefetch" href="/assets/js/516.dfb113bc.js"><link rel="prefetch" href="/assets/js/517.96c71069.js"><link rel="prefetch" href="/assets/js/518.5594480e.js"><link rel="prefetch" href="/assets/js/519.91e848ae.js"><link rel="prefetch" href="/assets/js/52.dd230cd7.js"><link rel="prefetch" href="/assets/js/520.ebe69ce9.js"><link rel="prefetch" href="/assets/js/521.92b80342.js"><link rel="prefetch" href="/assets/js/522.6ce581ea.js"><link rel="prefetch" href="/assets/js/523.40b7f2f9.js"><link rel="prefetch" href="/assets/js/524.4ef256d3.js"><link rel="prefetch" href="/assets/js/525.19741e4a.js"><link rel="prefetch" href="/assets/js/526.e5de1675.js"><link rel="prefetch" href="/assets/js/527.9a79cd42.js"><link rel="prefetch" href="/assets/js/528.72732eb8.js"><link rel="prefetch" href="/assets/js/529.2ea03e45.js"><link rel="prefetch" href="/assets/js/53.a349c565.js"><link rel="prefetch" href="/assets/js/530.5d1103e7.js"><link rel="prefetch" href="/assets/js/531.82b032d6.js"><link rel="prefetch" href="/assets/js/532.12ee4beb.js"><link rel="prefetch" href="/assets/js/533.db9a90f7.js"><link rel="prefetch" href="/assets/js/534.fe139db4.js"><link rel="prefetch" href="/assets/js/535.056a6fbb.js"><link rel="prefetch" href="/assets/js/536.6bf85c15.js"><link rel="prefetch" href="/assets/js/537.6e2e1ccf.js"><link rel="prefetch" href="/assets/js/538.54eddb3b.js"><link rel="prefetch" href="/assets/js/539.6f00a207.js"><link rel="prefetch" href="/assets/js/54.e292b52f.js"><link rel="prefetch" href="/assets/js/540.9c956205.js"><link rel="prefetch" href="/assets/js/541.50f41228.js"><link rel="prefetch" href="/assets/js/542.a2b1879e.js"><link rel="prefetch" href="/assets/js/543.4e5e17c9.js"><link rel="prefetch" href="/assets/js/544.63d85227.js"><link rel="prefetch" href="/assets/js/545.c3923644.js"><link rel="prefetch" href="/assets/js/546.e64ad073.js"><link rel="prefetch" href="/assets/js/547.35a8752d.js"><link rel="prefetch" href="/assets/js/548.b62a1348.js"><link rel="prefetch" href="/assets/js/549.369e2ea0.js"><link rel="prefetch" href="/assets/js/55.21bb2983.js"><link rel="prefetch" href="/assets/js/550.b4632248.js"><link rel="prefetch" href="/assets/js/551.18f1879c.js"><link rel="prefetch" href="/assets/js/552.162e63cd.js"><link rel="prefetch" href="/assets/js/553.6998130e.js"><link rel="prefetch" href="/assets/js/554.89126c3d.js"><link rel="prefetch" href="/assets/js/555.a5f63b8a.js"><link rel="prefetch" href="/assets/js/556.35381cef.js"><link rel="prefetch" href="/assets/js/557.ceeecf52.js"><link rel="prefetch" href="/assets/js/558.253e6e4f.js"><link rel="prefetch" href="/assets/js/559.5cfbb773.js"><link rel="prefetch" href="/assets/js/56.5382d6b4.js"><link rel="prefetch" href="/assets/js/560.cca52f22.js"><link rel="prefetch" href="/assets/js/561.ea8d1141.js"><link rel="prefetch" href="/assets/js/562.c32e7b96.js"><link rel="prefetch" href="/assets/js/563.9bdd42e7.js"><link rel="prefetch" href="/assets/js/564.b3b87ec0.js"><link rel="prefetch" href="/assets/js/565.4be0d0f7.js"><link rel="prefetch" href="/assets/js/566.9f379d12.js"><link rel="prefetch" href="/assets/js/567.261e3181.js"><link rel="prefetch" href="/assets/js/568.4229e365.js"><link rel="prefetch" href="/assets/js/569.e662c167.js"><link rel="prefetch" href="/assets/js/57.8129f7e0.js"><link rel="prefetch" href="/assets/js/570.97ff6423.js"><link rel="prefetch" href="/assets/js/571.de1377cd.js"><link rel="prefetch" href="/assets/js/572.48b8400b.js"><link rel="prefetch" href="/assets/js/573.8251ebaf.js"><link rel="prefetch" href="/assets/js/574.ec3d6c1e.js"><link rel="prefetch" href="/assets/js/575.b0d429a1.js"><link rel="prefetch" href="/assets/js/576.98ce9170.js"><link rel="prefetch" href="/assets/js/577.85fc2017.js"><link rel="prefetch" href="/assets/js/578.1393ac7f.js"><link rel="prefetch" href="/assets/js/579.1340e178.js"><link rel="prefetch" href="/assets/js/58.85ac2740.js"><link rel="prefetch" href="/assets/js/580.a5979445.js"><link rel="prefetch" href="/assets/js/581.effdc269.js"><link rel="prefetch" href="/assets/js/582.13276063.js"><link rel="prefetch" href="/assets/js/583.357a2443.js"><link rel="prefetch" href="/assets/js/584.338ef731.js"><link rel="prefetch" href="/assets/js/585.87932741.js"><link rel="prefetch" href="/assets/js/586.b1d6e000.js"><link rel="prefetch" href="/assets/js/587.ed5b8377.js"><link rel="prefetch" href="/assets/js/588.16d2c418.js"><link rel="prefetch" href="/assets/js/589.c96fd7fa.js"><link rel="prefetch" href="/assets/js/59.0b225757.js"><link rel="prefetch" href="/assets/js/590.1a06b2a0.js"><link rel="prefetch" href="/assets/js/591.0efd886c.js"><link rel="prefetch" href="/assets/js/592.b22d0ef5.js"><link rel="prefetch" href="/assets/js/593.84ed6ebe.js"><link rel="prefetch" href="/assets/js/594.cd721b88.js"><link rel="prefetch" href="/assets/js/595.2400817a.js"><link rel="prefetch" href="/assets/js/596.f2c512d1.js"><link rel="prefetch" href="/assets/js/597.df10ec57.js"><link rel="prefetch" href="/assets/js/598.61ef6a7d.js"><link rel="prefetch" href="/assets/js/599.0bebb562.js"><link rel="prefetch" href="/assets/js/6.29d112b1.js"><link rel="prefetch" href="/assets/js/60.3bbab51d.js"><link rel="prefetch" href="/assets/js/600.1ea7596f.js"><link rel="prefetch" href="/assets/js/601.f2642bb3.js"><link rel="prefetch" href="/assets/js/602.400cc987.js"><link rel="prefetch" href="/assets/js/603.db77d173.js"><link rel="prefetch" href="/assets/js/604.0ffa30ae.js"><link rel="prefetch" href="/assets/js/605.32ca9607.js"><link rel="prefetch" href="/assets/js/606.8c1e5683.js"><link rel="prefetch" href="/assets/js/607.9c9463ef.js"><link rel="prefetch" href="/assets/js/608.d5efa77e.js"><link rel="prefetch" href="/assets/js/609.5bbffb7d.js"><link rel="prefetch" href="/assets/js/61.f7301486.js"><link rel="prefetch" href="/assets/js/610.5b0fc9da.js"><link rel="prefetch" href="/assets/js/611.bb8058c9.js"><link rel="prefetch" href="/assets/js/612.b0788f43.js"><link rel="prefetch" href="/assets/js/613.49511e65.js"><link rel="prefetch" href="/assets/js/614.fae3eacf.js"><link rel="prefetch" href="/assets/js/615.359e5899.js"><link rel="prefetch" href="/assets/js/616.905132f4.js"><link rel="prefetch" href="/assets/js/617.6c8c594e.js"><link rel="prefetch" href="/assets/js/618.6ac4f3ff.js"><link rel="prefetch" href="/assets/js/619.411a0c14.js"><link rel="prefetch" href="/assets/js/62.9aeede84.js"><link rel="prefetch" href="/assets/js/620.56155724.js"><link rel="prefetch" href="/assets/js/621.149d7933.js"><link rel="prefetch" href="/assets/js/622.f0c9bc08.js"><link rel="prefetch" href="/assets/js/623.e0989fbe.js"><link rel="prefetch" href="/assets/js/624.80b1f6a9.js"><link rel="prefetch" href="/assets/js/625.a0a392c4.js"><link rel="prefetch" href="/assets/js/626.56fd4e8a.js"><link rel="prefetch" href="/assets/js/627.264e7313.js"><link rel="prefetch" href="/assets/js/628.7a868b19.js"><link rel="prefetch" href="/assets/js/629.e7e15da1.js"><link rel="prefetch" href="/assets/js/63.4df55c8b.js"><link rel="prefetch" href="/assets/js/630.998c9b61.js"><link rel="prefetch" href="/assets/js/631.69aa049c.js"><link rel="prefetch" href="/assets/js/632.da3882c1.js"><link rel="prefetch" href="/assets/js/633.0d49adf0.js"><link rel="prefetch" href="/assets/js/634.f9984ede.js"><link rel="prefetch" href="/assets/js/635.f0439f65.js"><link rel="prefetch" href="/assets/js/636.54de4194.js"><link rel="prefetch" href="/assets/js/637.55d1c226.js"><link rel="prefetch" href="/assets/js/638.2a9a510f.js"><link rel="prefetch" href="/assets/js/639.8bec360e.js"><link rel="prefetch" href="/assets/js/64.7f3e5e81.js"><link rel="prefetch" href="/assets/js/640.30d7f96e.js"><link rel="prefetch" href="/assets/js/641.68100098.js"><link rel="prefetch" href="/assets/js/642.4b793817.js"><link rel="prefetch" href="/assets/js/643.d86a81ea.js"><link rel="prefetch" href="/assets/js/644.76327ea2.js"><link rel="prefetch" href="/assets/js/645.0ac6a923.js"><link rel="prefetch" href="/assets/js/646.cd92f728.js"><link rel="prefetch" href="/assets/js/647.f2c624e1.js"><link rel="prefetch" href="/assets/js/648.c8f3b955.js"><link rel="prefetch" href="/assets/js/649.6370753b.js"><link rel="prefetch" href="/assets/js/65.2beeae9b.js"><link rel="prefetch" href="/assets/js/650.afe31909.js"><link rel="prefetch" href="/assets/js/651.87971ec0.js"><link rel="prefetch" href="/assets/js/652.0adf10a6.js"><link rel="prefetch" href="/assets/js/653.1f655726.js"><link rel="prefetch" href="/assets/js/654.53e24c7c.js"><link rel="prefetch" href="/assets/js/655.c95a66ea.js"><link rel="prefetch" href="/assets/js/656.38b5a5ea.js"><link rel="prefetch" href="/assets/js/657.3167aa94.js"><link rel="prefetch" href="/assets/js/658.7c40ff62.js"><link rel="prefetch" href="/assets/js/659.5d2b9b54.js"><link rel="prefetch" href="/assets/js/66.44b214db.js"><link rel="prefetch" href="/assets/js/660.96a8da9e.js"><link rel="prefetch" href="/assets/js/661.4de3b6c1.js"><link rel="prefetch" href="/assets/js/662.7d9bf181.js"><link rel="prefetch" href="/assets/js/663.4ccaf40a.js"><link rel="prefetch" href="/assets/js/664.7ab4fa53.js"><link rel="prefetch" href="/assets/js/665.32245d26.js"><link rel="prefetch" href="/assets/js/666.e6617151.js"><link rel="prefetch" href="/assets/js/667.fb3b0547.js"><link rel="prefetch" href="/assets/js/668.3d1b2e36.js"><link rel="prefetch" href="/assets/js/669.b769905f.js"><link rel="prefetch" href="/assets/js/67.c31aaacf.js"><link rel="prefetch" href="/assets/js/670.88ed3af3.js"><link rel="prefetch" href="/assets/js/671.1aff6bfe.js"><link rel="prefetch" href="/assets/js/672.c90888f7.js"><link rel="prefetch" href="/assets/js/673.81241fdc.js"><link rel="prefetch" href="/assets/js/674.838a424d.js"><link rel="prefetch" href="/assets/js/675.603ac896.js"><link rel="prefetch" href="/assets/js/676.ff44b5dc.js"><link rel="prefetch" href="/assets/js/677.41a8087a.js"><link rel="prefetch" href="/assets/js/678.f0eb8d04.js"><link rel="prefetch" href="/assets/js/679.db78199e.js"><link rel="prefetch" href="/assets/js/68.08607c89.js"><link rel="prefetch" href="/assets/js/680.8fded9d4.js"><link rel="prefetch" href="/assets/js/681.0b019dfd.js"><link rel="prefetch" href="/assets/js/682.746e9190.js"><link rel="prefetch" href="/assets/js/683.d5c00845.js"><link rel="prefetch" href="/assets/js/684.b3207cad.js"><link rel="prefetch" href="/assets/js/685.d78f18ba.js"><link rel="prefetch" href="/assets/js/686.5aaecd19.js"><link rel="prefetch" href="/assets/js/687.821a06f4.js"><link rel="prefetch" href="/assets/js/688.8bbc1890.js"><link rel="prefetch" href="/assets/js/689.79b49e8c.js"><link rel="prefetch" href="/assets/js/69.509245d6.js"><link rel="prefetch" href="/assets/js/690.fa62f9dd.js"><link rel="prefetch" href="/assets/js/691.d3eb1a60.js"><link rel="prefetch" href="/assets/js/692.738f14bb.js"><link rel="prefetch" href="/assets/js/693.e6a497a2.js"><link rel="prefetch" href="/assets/js/694.6eea1c54.js"><link rel="prefetch" href="/assets/js/695.88e6acee.js"><link rel="prefetch" href="/assets/js/696.de10297f.js"><link rel="prefetch" href="/assets/js/697.96d04062.js"><link rel="prefetch" href="/assets/js/698.200cc84f.js"><link rel="prefetch" href="/assets/js/699.f11fc627.js"><link rel="prefetch" href="/assets/js/7.c16198b8.js"><link rel="prefetch" href="/assets/js/70.5f6285b1.js"><link rel="prefetch" href="/assets/js/700.93d48f59.js"><link rel="prefetch" href="/assets/js/701.b861f29a.js"><link rel="prefetch" href="/assets/js/702.dc82e05c.js"><link rel="prefetch" href="/assets/js/703.625ce87c.js"><link rel="prefetch" href="/assets/js/704.005a0a7c.js"><link rel="prefetch" href="/assets/js/705.16ad9230.js"><link rel="prefetch" href="/assets/js/706.4eead30a.js"><link rel="prefetch" href="/assets/js/707.730306ce.js"><link rel="prefetch" href="/assets/js/708.e37e743a.js"><link rel="prefetch" href="/assets/js/709.f2144f52.js"><link rel="prefetch" href="/assets/js/71.d5d0dae5.js"><link rel="prefetch" href="/assets/js/710.ee9d9b17.js"><link rel="prefetch" href="/assets/js/711.2813c338.js"><link rel="prefetch" href="/assets/js/712.e801bce4.js"><link rel="prefetch" href="/assets/js/713.21fc267c.js"><link rel="prefetch" href="/assets/js/714.4ec35525.js"><link rel="prefetch" href="/assets/js/715.fdc3cc84.js"><link rel="prefetch" href="/assets/js/716.324932ad.js"><link rel="prefetch" href="/assets/js/717.a072a66f.js"><link rel="prefetch" href="/assets/js/718.575e0305.js"><link rel="prefetch" href="/assets/js/719.5fdd55de.js"><link rel="prefetch" href="/assets/js/72.25648231.js"><link rel="prefetch" href="/assets/js/720.61477f23.js"><link rel="prefetch" href="/assets/js/721.c8bdab00.js"><link rel="prefetch" href="/assets/js/722.9255f385.js"><link rel="prefetch" href="/assets/js/723.f27792a4.js"><link rel="prefetch" href="/assets/js/724.cd504f88.js"><link rel="prefetch" href="/assets/js/725.55c845fa.js"><link rel="prefetch" href="/assets/js/726.bb49a9db.js"><link rel="prefetch" href="/assets/js/727.53d587fe.js"><link rel="prefetch" href="/assets/js/728.86972387.js"><link rel="prefetch" href="/assets/js/729.02fa0263.js"><link rel="prefetch" href="/assets/js/73.29902c1f.js"><link rel="prefetch" href="/assets/js/730.817156d1.js"><link rel="prefetch" href="/assets/js/731.6f5d6735.js"><link rel="prefetch" href="/assets/js/732.9a5ff781.js"><link rel="prefetch" href="/assets/js/733.bcb13916.js"><link rel="prefetch" href="/assets/js/734.11482b19.js"><link rel="prefetch" href="/assets/js/735.8c0d62f3.js"><link rel="prefetch" href="/assets/js/736.06465705.js"><link rel="prefetch" href="/assets/js/737.79741d87.js"><link rel="prefetch" href="/assets/js/738.cad12ff9.js"><link rel="prefetch" href="/assets/js/739.cb09e552.js"><link rel="prefetch" href="/assets/js/74.bcf666a0.js"><link rel="prefetch" href="/assets/js/740.029b1950.js"><link rel="prefetch" href="/assets/js/741.b937216a.js"><link rel="prefetch" href="/assets/js/742.ec02c706.js"><link rel="prefetch" href="/assets/js/743.70a96283.js"><link rel="prefetch" href="/assets/js/744.909b870c.js"><link rel="prefetch" href="/assets/js/745.80defb2d.js"><link rel="prefetch" href="/assets/js/746.fb972248.js"><link rel="prefetch" href="/assets/js/747.1a7b52fd.js"><link rel="prefetch" href="/assets/js/748.036f5d16.js"><link rel="prefetch" href="/assets/js/749.bd9a413d.js"><link rel="prefetch" href="/assets/js/75.23c5a54d.js"><link rel="prefetch" href="/assets/js/750.3f1ae8f5.js"><link rel="prefetch" href="/assets/js/751.8897bc9f.js"><link rel="prefetch" href="/assets/js/752.9b387659.js"><link rel="prefetch" href="/assets/js/753.f411ce21.js"><link rel="prefetch" href="/assets/js/754.26def684.js"><link rel="prefetch" href="/assets/js/755.923aff62.js"><link rel="prefetch" href="/assets/js/756.9965743a.js"><link rel="prefetch" href="/assets/js/757.0c6bbbfd.js"><link rel="prefetch" href="/assets/js/758.a830f8b1.js"><link rel="prefetch" href="/assets/js/759.987cad77.js"><link rel="prefetch" href="/assets/js/76.f54f3d4f.js"><link rel="prefetch" href="/assets/js/760.9f2652a0.js"><link rel="prefetch" href="/assets/js/761.df01a0ee.js"><link rel="prefetch" href="/assets/js/762.e0c05a1a.js"><link rel="prefetch" href="/assets/js/763.da8a60bd.js"><link rel="prefetch" href="/assets/js/764.9f2a2830.js"><link rel="prefetch" href="/assets/js/765.44e61161.js"><link rel="prefetch" href="/assets/js/766.cd7da8c1.js"><link rel="prefetch" href="/assets/js/767.6ea1fea2.js"><link rel="prefetch" href="/assets/js/768.91529b8f.js"><link rel="prefetch" href="/assets/js/769.194d7a3e.js"><link rel="prefetch" href="/assets/js/77.3d43a163.js"><link rel="prefetch" href="/assets/js/770.227fd5b9.js"><link rel="prefetch" href="/assets/js/771.44d5e37e.js"><link rel="prefetch" href="/assets/js/772.234d9bf6.js"><link rel="prefetch" href="/assets/js/773.ff1dfb6a.js"><link rel="prefetch" href="/assets/js/774.d401364f.js"><link rel="prefetch" href="/assets/js/775.37a7cf41.js"><link rel="prefetch" href="/assets/js/776.0cd10853.js"><link rel="prefetch" href="/assets/js/777.599a3a48.js"><link rel="prefetch" href="/assets/js/778.eef27a95.js"><link rel="prefetch" href="/assets/js/779.29351199.js"><link rel="prefetch" href="/assets/js/78.fd0780ac.js"><link rel="prefetch" href="/assets/js/780.74caed94.js"><link rel="prefetch" href="/assets/js/781.ee0fa9b5.js"><link rel="prefetch" href="/assets/js/782.7cffed09.js"><link rel="prefetch" href="/assets/js/783.7f01f518.js"><link rel="prefetch" href="/assets/js/784.5f65e3d7.js"><link rel="prefetch" href="/assets/js/785.d7e13880.js"><link rel="prefetch" href="/assets/js/786.6110d12f.js"><link rel="prefetch" href="/assets/js/787.334a5cdd.js"><link rel="prefetch" href="/assets/js/788.f261bc71.js"><link rel="prefetch" href="/assets/js/789.b6d74f7d.js"><link rel="prefetch" href="/assets/js/79.7b5d6224.js"><link rel="prefetch" href="/assets/js/790.fa948ec4.js"><link rel="prefetch" href="/assets/js/791.22080013.js"><link rel="prefetch" href="/assets/js/792.31ce806c.js"><link rel="prefetch" href="/assets/js/793.9fd0c56f.js"><link rel="prefetch" href="/assets/js/794.44a8cd9c.js"><link rel="prefetch" href="/assets/js/795.9f8346e5.js"><link rel="prefetch" href="/assets/js/796.0de9c7a1.js"><link rel="prefetch" href="/assets/js/797.83ac32a6.js"><link rel="prefetch" href="/assets/js/798.393fc81d.js"><link rel="prefetch" href="/assets/js/799.c1fb3981.js"><link rel="prefetch" href="/assets/js/8.3275ed06.js"><link rel="prefetch" href="/assets/js/80.df3f0a1f.js"><link rel="prefetch" href="/assets/js/800.2832adeb.js"><link rel="prefetch" href="/assets/js/801.04c58fc4.js"><link rel="prefetch" href="/assets/js/81.3d90ef6b.js"><link rel="prefetch" href="/assets/js/82.2d42448d.js"><link rel="prefetch" href="/assets/js/83.900b4de2.js"><link rel="prefetch" href="/assets/js/84.ff570f67.js"><link rel="prefetch" href="/assets/js/85.e3b3af39.js"><link rel="prefetch" href="/assets/js/86.17b5aedc.js"><link rel="prefetch" href="/assets/js/87.f931d1d6.js"><link rel="prefetch" href="/assets/js/88.d55863cd.js"><link rel="prefetch" href="/assets/js/89.15a9a6d7.js"><link rel="prefetch" href="/assets/js/9.04948a9d.js"><link rel="prefetch" href="/assets/js/90.22696aa9.js"><link rel="prefetch" href="/assets/js/91.f1bd8a2e.js"><link rel="prefetch" href="/assets/js/92.85733094.js"><link rel="prefetch" href="/assets/js/93.59bacfd7.js"><link rel="prefetch" href="/assets/js/94.a5f9b7a0.js"><link rel="prefetch" href="/assets/js/95.be52d65a.js"><link rel="prefetch" href="/assets/js/96.0b76ba8e.js"><link rel="prefetch" href="/assets/js/97.28183cd4.js"><link rel="prefetch" href="/assets/js/98.2d22829c.js"><link rel="prefetch" href="/assets/js/99.ed602a20.js">
    <link rel="stylesheet" href="/assets/css/0.styles.a3df589e.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><!----> <span class="site-name">AJ</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link">主页</a></div><div class="nav-item"><a href="/op/" class="nav-link">Devops</a></div><div class="nav-item"><a href="/golang/" class="nav-link">Go</a></div><div class="nav-item"><a href="/go-block/" class="nav-link">区块链</a></div><div class="nav-item"><a href="/k8s/" class="nav-link router-link-active">k8s</a></div><div class="nav-item"><a href="/about.html" class="nav-link">关于我</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="更多" class="dropdown-title"><span class="title">更多</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/go-learning/" class="nav-link">go-learning</a></li><li class="dropdown-item"><!----> <a href="/post/flutter-guide/" class="nav-link">flutter</a></li><li class="dropdown-item"><!----> <a href="/mysql/" class="nav-link">mysql</a></li><li class="dropdown-item"><!----> <a href="/python/" class="nav-link">python</a></li></ul></div></div> <a href="https://github.com/ChinaArJun" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link">主页</a></div><div class="nav-item"><a href="/op/" class="nav-link">Devops</a></div><div class="nav-item"><a href="/golang/" class="nav-link">Go</a></div><div class="nav-item"><a href="/go-block/" class="nav-link">区块链</a></div><div class="nav-item"><a href="/k8s/" class="nav-link router-link-active">k8s</a></div><div class="nav-item"><a href="/about.html" class="nav-link">关于我</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="更多" class="dropdown-title"><span class="title">更多</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/go-learning/" class="nav-link">go-learning</a></li><li class="dropdown-item"><!----> <a href="/post/flutter-guide/" class="nav-link">flutter</a></li><li class="dropdown-item"><!----> <a href="/mysql/" class="nav-link">mysql</a></li><li class="dropdown-item"><!----> <a href="/python/" class="nav-link">python</a></li></ul></div></div> <a href="https://github.com/ChinaArJun" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav> <div></div> <div style="padding-left:1.5rem;"><div></div></div> <ul class="sidebar-links"><li><a href="/k8s/" aria-current="page" class="sidebar-link">目录</a></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>集群搭建</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/k8s/prepare.html" class="sidebar-link">预备工作</a></li><li><a href="/k8s/linux-command.html" class="sidebar-link">搭建过程中常用的 linux 命令</a></li><li><a href="/k8s/install-docker.html" class="sidebar-link">docker 安装与配置</a></li><li><a href="/k8s/install-kubeadm.html" class="sidebar-link">kubeadm 简介与安装</a></li><li><a href="/k8s/install-master-node.html" class="sidebar-link">搭建第一个 kubernetes 集群</a></li><li><a href="/k8s/install-worker-node.html" class="sidebar-link">为集群添加一个工作节点</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>部署你的第一个应用</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/k8s/k8s-network.html" class="sidebar-link">从外部访问Kubernetes Pod的几种方式</a></li><li><a href="/k8s/pod.html" class="sidebar-link">部署你的第一个应用: Pod，Deployment 与 Service</a></li><li><a href="/k8s/ingress.html" class="sidebar-link">在外网访问你的应用: Ingress</a></li><li><a href="/k8s/https.html" class="sidebar-link">为你的应用自动生成证书</a></li><li><a href="/k8s/" aria-current="page" class="sidebar-link">有状态应用: Stateful Application - TODO</a></li><li><a href="/k8s/" aria-current="page" class="sidebar-link">状态管理: PV 与 PVC - TODO</a></li><li><a href="/k8s/" aria-current="page" class="sidebar-link">使用 helm 部署 redis - TODO</a></li><li><a href="/k8s/" aria-current="page" class="sidebar-link">使用 helm 部署 postgres - TODO</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>kubernetes 与微服务</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/k8s/" aria-current="page" class="sidebar-link">服务质量: 资源分配，限额与抢占 - TODO</a></li><li><a href="/k8s/" aria-current="page" class="sidebar-link">服务发现与原理 - TODO</a></li><li><a href="/k8s/" aria-current="page" class="sidebar-link">负载均衡: 方案 - TODO</a></li><li><a href="/k8s/" aria-current="page" class="sidebar-link">负载均衡: iptables 与 IPVS - TODO</a></li><li><a href="/k8s/" aria-current="page" class="sidebar-link">链路追踪 - TODO</a></li><li><a href="/k8s/" aria-current="page" class="sidebar-link">熔断 - TODO</a></li><li><a href="/k8s/" aria-current="page" class="sidebar-link">限流 - TODO</a></li></ul></section></li></ul> </aside> <!----> <!----> <main class="page"><div class="theme-default-content" style="margin-bottom:-5rem;"><div class="bar"><div class="bar-intro"><div class="text">
      流逝的是岁月，不变的是情怀.
        </div> <div class="text">
      坚持学习，是为了成就更好的自己. <br></div> <div>公众号[中关村程序员]</div></div></div> <!----></div> <div class="theme-default-content content__default"><h1 id="_2小时躲坑k8s-大型分布式集群环境捷径部署"><a href="#_2小时躲坑k8s-大型分布式集群环境捷径部署" class="header-anchor">#</a> 2小时躲坑k8s-大型分布式集群环境捷径部署</h1> <h2 id="课程介绍"><a href="#课程介绍" class="header-anchor">#</a> 课程介绍</h2> <p>​	Kubernetes(k8s)一个用于<strong>容器</strong>集群的自动化部署、扩容以及运维的开源平台。通过Kubernetes,你可以<strong>快速有效地响应</strong>用户需求;快速而有预期地部署你的应用;极速地<strong>扩展</strong>你的应用;无缝<strong>对接新应用</strong>功能;节省资源，优化<strong>硬件资源</strong>的使用。为容器编排管理提供了完整的开源方案。</p> <p>Kubernetes解决了什么问题？</p> <ul><li>服务器环境</li> <li>服务器资源管理</li> <li>服务容灾恢复</li> <li>硬件资源利用</li> <li>服务资源创建</li> <li>可视化管理</li> <li>服务资源监控</li> <li>资源整合管理</li></ul> <p>Kubernetes在容器编排可谓是做到了淋漓尽致，解决了之前的种种痛点，但是学习成本也相对较高，需要结合一定的实践，踩一定的坑才能形成自己的理解。</p> <h3 id="目标"><a href="#目标" class="header-anchor">#</a> 目标</h3> <ul><li>了解什么是k8s，为什么世界需要它，k8s的工程师又为什么这么抢手。</li> <li>k8s企业环境部署捷径，多Master/node躲坑快速部署。</li> <li>基于Kubernetes集群管理,kubeadm，kubectl等常见指令使用。</li> <li>基于Kubernetes快速启动集群Web应用。</li></ul> <h1 id="一、kubernetes概述"><a href="#一、kubernetes概述" class="header-anchor">#</a> 一、Kubernetes概述</h1> <h2 id="_1、什么是k8s"><a href="#_1、什么是k8s" class="header-anchor">#</a> 1、什么是k8s</h2> <p>Kubernetes（K8s）是Google在2014年发布的一个开源项目。</p> <p>​	据说Google的数据中心里运行着20多亿个容器，而且Google十年多前就开始使用容器技术。</p> <p>​	最初，Google开发了一个叫Borg的系统（现在命名为Omega）来调度如此庞大数量的容器和工作负载。在积累了这么多年的经验后，Google决定重写这个容器管理系统，并将其贡献到开源社区，让全世界都能受益。</p> <p>​	这个项目就是Kubernetes。简单地讲，Kubernetes是Google Omega的开源版本。</p> <p>​	从2014年第一个版本发布以来，Kubernetes迅速获得开源社区的追捧，包括Red Hat、VMware、Canonical在内的很多有影响力的公司加入到开发和推广的阵营。目前Kubernetes已经成为发展最快、市场占有率最高的容器编排引擎产品。</p> <p><img src="" alt="k8s2"></p> <p><img src="" alt="k8s3"></p> <h2 id="_2、kubernetes解决了什么问题"><a href="#_2、kubernetes解决了什么问题" class="header-anchor">#</a> 2、Kubernetes解决了什么问题</h2> <ul><li>通过 Kubernetes，分布式系统工具将拥有网络效应。每当人们为 Kubernetes 制作出的新的工具，都会让所有其他工具更完善。因此，这进一步巩固了 Kubernetes 的标准地位。</li> <li>云提供商并非可替换的商品。不同的云提供的服务会变得越来越独特和不同。如果可以访问不同的云提供商提供的不同服务，那么企业将因此受益。</li> <li>当多节点应用与单节点应用一样可靠时，我们将看到定价模型的变化。</li> <li>这就是为什么我会被 Kubernetes 洗脑的原因，它是跨越异构系统的一个标准层。</li> <li>将来，我们会像讨论编译器和操作系统内核一样讨论 Kubernetes。 Kubernetes 将会是低层级的管路系统，而不在普通应用开发人员的视野之内。</li></ul> <p>Kubernetes 已成为部署分布式应用的标准方式。在不远的将来，任何新成立的互联网公司都将用到 Kubernetes，无论其是否意识到这点。许多旧应用也正在迁移到 Kubernetes。</p> <h4 id="_2-1-起因：docker"><a href="#_2-1-起因：docker" class="header-anchor">#</a> 2.1 起因：Docker</h4> <p><img src="/assets/img/k8s5.04fd19e3.png" alt="image-20190620115317209"></p> <h4 id="单一稳定的一体化模型"><a href="#单一稳定的一体化模型" class="header-anchor">#</a> 单一稳定的一体化模型</h4> <p><img src="/assets/img/k8s6.f684d73f.png" alt="img"></p> <h4 id="微型化的应用部署模型"><a href="#微型化的应用部署模型" class="header-anchor">#</a> 微型化的应用部署模型</h4> <p>(微服务、分布式、集群、高可用、负载均衡...)</p> <p><img src="/assets/img/k8s7.ac8b7519.png" alt="img"></p> <h4 id="_2-2-容器编排？是需要标准的？"><a href="#_2-2-容器编排？是需要标准的？" class="header-anchor">#</a> 2.2 容器编排？是需要标准的？</h4> <p>如此多的docker该如何管理(通信、负载均衡、资源共享管理、容灾、监控、健康检查….)？</p> <ul><li>Mesos</li></ul> <p><img src="" alt="img"></p> <ul><li>docker swarm</li></ul> <p><img src="/assets/img/k8s9.6aa5714c.png" alt="img"></p> <ul><li>kubernetes</li></ul> <p><img src="/assets/img/k8s10.b115387d.png" alt="image-20190620135040659"></p> <p>自2016年中，k8s表现出明显优势。</p> <p><img src="/assets/img/k8s11.dcbf8b8c.png" alt="image-20190620143819102"></p> <h3 id="_3-kubernetes工程师价值"><a href="#_3-kubernetes工程师价值" class="header-anchor">#</a> 3. kubernetes工程师价值</h3> <p><img src="/assets/img/k8s4.97c31b8f.png" alt="image-20190620114057180"></p> <h1 id="二、环境"><a href="#二、环境" class="header-anchor">#</a> 二、环境</h1> <h2 id="_2-1-部署软件环境版本"><a href="#_2-1-部署软件环境版本" class="header-anchor">#</a> 2.1 部署软件环境版本</h2> <p>操作系统: <code>Ubuntu 18.10</code>(本教程采用server版本)</p> <p>Docker： <code>docker-ce 18.06</code></p> <p>Kubernetes: <code>k8s 1.13.1</code></p> <h2 id="_2-2-ubuntu搭建研发环境"><a href="#_2-2-ubuntu搭建研发环境" class="header-anchor">#</a> 2.2 Ubuntu搭建研发环境</h2> <p>我们直接下载Unbuntu18.10-server版本，server版本的好处是没有Desktop,可以节省资源。</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token function">wget</span> http://mirrors.aliyun.com/ubuntu-releases/18.10/ubuntu-18.10-live-server-amd64.iso
</code></pre></div><blockquote><p>注:也可以从配套资料中获取</p></blockquote> <h2 id="_2-3-ubuntu安装过程"><a href="#_2-3-ubuntu安装过程" class="header-anchor">#</a> 2.3 Ubuntu安装过程</h2> <h3 id="_2-3-1-创建虚拟机"><a href="#_2-3-1-创建虚拟机" class="header-anchor">#</a> 2.3.1 创建虚拟机</h3> <p>在VMWare 中启动安装虚拟过程</p> <ol><li><p>创建新的虚拟机，选择推荐版本的iso文件</p> <p><img src="/assets/img/ubuntu1.c10ccf95.jpg" alt="ubuntu1"></p></li> <li><p>选择自定义安装</p></li> <li><p>为此虚拟机选择操作系统 <code>Linux Ubuntu 64位</code></p></li> <li><p>指定引导固件<code>UEFI</code> 不要选择<code>BIOS</code></p> <p><img src="/assets/img/ubuntu2.4888586c.jpg" alt="ubuntu2"></p></li> <li><p>命名为<strong>Master</strong></p></li> <li><p>自定设置 存储为<strong>UbuntuMaster</strong> <strong>2CPU  2048MB 20GB硬盘</strong></p> <p><img src="/assets/img/ubuntu3.18930fd5.jpg" alt="ubuntu3"></p> <p><img src="/assets/img/ubuntu4.c1a84fa4.jpg" alt="ubuntu4"></p></li> <li><p>建议移除声卡和摄像头</p></li></ol> <h3 id="_2-3-2-图形界面安装方式"><a href="#_2-3-2-图形界面安装方式" class="header-anchor">#</a> 2.3.2 图形界面安装方式</h3> <ol><li><p>选择英文语言</p></li> <li><p>英文键盘</p></li> <li><p>设置国内镜像源头 <code>http://mirrors.aliyun.com/ubuntu/</code> 注意末尾的斜线</p></li> <li><p>设置您的用户名和密码，下文使用<em>YOUR_USERNAME</em> <em>YOUR_PASSWORD</em></p></li> <li><p><strong>切勿选择</strong> <code>microk8s snap</code> <code>stable: v1.14.2</code> 空格选中</p></li></ol> <p><img src="/assets/img/ubuntu5.90f54fd2.jpg" alt="ubuntu5"></p> <ol start="6"><li>Tab键切换到<em>DONE</em>回车，开始安装过程</li></ol> <p><img src="/assets/img/ubuntu6.2ecc47eb.jpg" alt="ubuntu6"></p> <ol start="7"><li><p>安装结束后点击重启<em>Reboot Now</em></p> <p><img src="/assets/img/ubuntu7.549a17e6.jpg" alt="ubuntu7"></p></li></ol> <h3 id="修改root密码"><a href="#修改root密码" class="header-anchor">#</a> 修改root密码</h3> <ol><li>安装过程中，输入用户名 <code>YOUR_USERNAME</code> 密码: <code>YOUR_PASSWORD</code></li> <li>重新启动后登录 用户名 <code>YOUR_USERNAME</code> 密码: <code>YOUR_PASSWORD</code></li> <li>确认登录成功后输入<code>sudo passwd</code> 输入上面的<code>YOUR_PASSWORD</code>,然后输入root用户的密码<code>root</code></li></ol> <div class="language- extra-class"><pre class="language-text"><code>设置root用户的密码root，是为了教学过程中简单。
但是在生产环境下禁止使用弱强度的密码。
</code></pre></div><p><img src="/assets/img/ubuntu8.74cd3169.jpg" alt="ubuntu8"></p> <ol start="4"><li>执行<code>exit</code>退出当前登录用户，然后使用root用户重新登录</li> <li>输入<code>shutdown now</code>停机</li></ol> <h2 id="_2-4-修改主机名"><a href="#_2-4-修改主机名" class="header-anchor">#</a> 2.4 修改主机名</h2> <p>修改主机名称</p> <ol><li>使用root用户登录</li> <li>打开配置文件<code>vim /etc/cloud/cloud.cfg</code></li> <li>修改配置<code>preserve_hostname: true</code></li></ol> <p><img src="/assets/img/ubuntu9.544e3cfc.jpg" alt="ubuntu9"></p> <ol start="3"><li>重启</li></ol> <div class="language-shell extra-class"><pre class="language-shell"><code>$ <span class="token function">shutdown</span> -r now
</code></pre></div><h2 id=""><a href="#" class="header-anchor">#</a></h2> <h2 id="_2-5-配置静态ip-永久有效-nat模式"><a href="#_2-5-配置静态ip-永久有效-nat模式" class="header-anchor">#</a> 2.5 配置静态IP(永久有效)(NAT模式)</h2> <ol><li>使用root用户登录Linux，如下以Node2为例</li> <li><code>vim /etc/netplan/50-cloud-init.yaml</code></li> <li>参考如下截图修改配置文件</li></ol> <ul><li>UbuntuMaster <code>172.16.235.146</code></li> <li>UbuntuNode1 <code>172.16.235.147</code></li> <li>UbuntuNode2 <code>172.16.235.148</code></li></ul> <div class="language-bash extra-class"><pre class="language-bash"><code>network:
    ethernets:
        ens33:
            addresses: <span class="token punctuation">[</span><span class="token number">192.168</span>.236.177/24<span class="token punctuation">]</span>
            dhcp4: <span class="token boolean">false</span>
            gateway4: <span class="token number">192.168</span>.236.2
            nameservers:
                       addresses: <span class="token punctuation">[</span><span class="token number">192.168</span>.236.2<span class="token punctuation">]</span>
            optional: <span class="token boolean">true</span>
    version: <span class="token number">2</span>              
</code></pre></div><p>或者动态获取</p> <p><img src="/assets/img/ubuntu10.456d2102.png" alt="image-20190617115306138"></p> <h2 id="_2-6-修改hosts"><a href="#_2-6-修改hosts" class="header-anchor">#</a> 2.6 修改hosts</h2> <p>使用root用户登录</p> <ol><li><p>打开hosts文件 <code>vim /etc/hosts</code></p></li> <li><p>输入如下内容</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token number">192.168</span>.236.177 master
</code></pre></div><p>这个ip是当前桥接或者NAT分配的IP地址</p></li> <li><p>重启机器<code>shutdown -r now</code></p></li></ol> <h2 id="ip应用启动："><a href="#ip应用启动：" class="header-anchor">#</a> ip应用启动：</h2> <p><code>$netplan apply</code></p> <h1 id="三、docker-ce安装及配置"><a href="#三、docker-ce安装及配置" class="header-anchor">#</a> 三、Docker-CE安装及配置</h1> <h2 id="_3-1-docker简介"><a href="#_3-1-docker简介" class="header-anchor">#</a> 3.1 Docker简介</h2> <h3 id="_3-1-1-docker介绍"><a href="#_3-1-1-docker介绍" class="header-anchor">#</a> 3. 1.1 docker介绍</h3> <ul><li><p>docker是什么 ?</p> <blockquote><p>Docker 是一个开源的应用<strong>容器引擎</strong>，是直接运行在宿主操作系统之上的一个容器，使用沙箱机制完全虚拟出一个完整的操作，容器之间不会有任何接口，从而让容器与宿主机之间、容器与容器之间隔离的更加彻底。每个容器会有自己的权限管理，独立的网络与存储栈，及自己的资源管理能，使同一台宿主机上可以友好的共存多个容器。</p></blockquote></li> <li><p>docker与虚拟机对比</p> <blockquote><p><font color="red"><strong>如果物理机是一幢住宅楼，虚拟机就是大楼中的一个个套间，而容器技术就是套间里的一个个隔断。</strong></font></p></blockquote> <ul><li><p>虚拟化技术不同</p> <blockquote><ul><li>VMware Workstation、VirtualBoX</li></ul> <p>硬件辅助虚拟化：（Hardware-assisted Virtualization）是指通过硬件辅助支持模拟运行环境，使客户机操作系统可以独立运行，实现完全虚拟化的功能。</p> <ul><li>Docker</li></ul> <p>操作系统层虚拟化：（OS-level virtualization）这种技术将操作系统内核虚拟化，可以允许使用者空间软件实例被分割成几个独立的单元，在内核中运行，而不是只有一个单一实例运行。这个软件实例，也被称为是一个容器（containers）、虚拟引擎（Virtualization engine）、虚拟专用服务器（virtual private servers）。每个容器的进程是独立的，对于使用者来说，就像是在使用自己的专用服务器。</p> <p><font color="red">以上两种虚拟化技术都属于软件虚拟化，在现有的物理平台上实现对物理平台访问的截获和模拟。在软件虚拟化技术中，有些技术不需要硬件支持；而有些软件虚拟化技术，则依赖硬件支持。</font></p></blockquote></li> <li><p>应用场景不同</p> <blockquote><ul><li>虚拟机更擅长于彻底隔离整个运行环境。如: 云服务提供商通常采用虚拟机技术隔离不同的用户。</li> <li>Docker通常用于隔离不同的应用，例如前端，后端以及数据库。</li></ul></blockquote></li> <li><p>资源的使用率不同</p> <blockquote><p>虚拟机启动需要数分钟，而Docker容器可以在数毫秒内启动。由于没有臃肿的从操作系统，Docker可以节省大量的磁盘空间以及其他系统资源。</p></blockquote></li></ul></li> <li><p>docker的版本</p> <ul><li>Docker-CE -&gt; 社区版
<ul><li>Stable 版
<ul><li>稳定版, 一个季度更新一次</li></ul></li> <li>Edge 版
<ul><li>一个月更新一般</li></ul></li></ul></li> <li>Docker-EE
<ul><li>企业版</li> <li>收费的</li></ul></li></ul></li></ul> <p><img src="/assets/img/docker1.05be8038.png" alt="docker1"></p> <h2 id="_3-2-配置国内源"><a href="#_3-2-配置国内源" class="header-anchor">#</a> 3.2 配置国内源</h2> <h3 id="_3-2-1-基础准备"><a href="#_3-2-1-基础准备" class="header-anchor">#</a> 3.2.1 基础准备</h3> <ol><li>Docker 要求 Ubuntu 系统的内核版本高于 3.10 ，查看本页面的前提条件来验证你的 Ubuntu 版本是否支持 Docker。</li></ol> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token function">uname</span> -r 
<span class="token number">4.18</span>.0-21-generic<span class="token punctuation">(</span>主版本必须保持一致<span class="token punctuation">)</span>
</code></pre></div><ol start="2"><li>安装<code>curl</code></li></ol> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token function">apt-get</span> update <span class="token operator">&amp;&amp;</span> <span class="token function">apt-get</span> <span class="token function">install</span> -y <span class="token function">curl</span> telnet <span class="token function">wget</span> <span class="token function">man</span> <span class="token punctuation">\</span>
apt-transport-https <span class="token punctuation">\</span>
ca-certificates <span class="token punctuation">\</span>
software-properties-common <span class="token function">vim</span> 

</code></pre></div><ol start="3"><li><p>查看新版本号</p> <ul><li>Ubuntu 18.10</li></ul> <div class="language-shell extra-class"><pre class="language-shell"><code>$ lsb_release -c
Codename:	cosmic
</code></pre></div></li> <li><p>查看确认国内源</p> <div class="language-shell extra-class"><pre class="language-shell"><code>	$ <span class="token function">cp</span> /etc/apt/sources.list /etc/apt/sources.list.bak
	$ <span class="token function">cat</span> /etc/apt/sources.list
</code></pre></div></li></ol> <h3 id="_3-2-2-在线安装docker-ce-本教程不推荐"><a href="#_3-2-2-在线安装docker-ce-本教程不推荐" class="header-anchor">#</a> 3.2.2 在线安装Docker-ce(本教程不推荐)</h3> <blockquote><p>(建议下面的手动安装方式，因为在线可能会出现版本不一致)</p></blockquote> <p>注意： <strong>该国内源目前提供 <code>18.09</code>版本，与k8s不符。k8s推荐安装<code>Docker ce 18.06</code></strong></p> <ol><li><p>安装GPG秘钥和添加国内镜像</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ <span class="token function">curl</span> -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg <span class="token operator">|</span> <span class="token function">sudo</span> apt-key <span class="token function">add</span> -
</code></pre></div><p>添加国内源头</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ add-apt-repository <span class="token punctuation">\</span>
    <span class="token string">&quot;deb https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \
    <span class="token variable"><span class="token variable">$(</span>lsb_release -cs<span class="token variable">)</span></span> \
    stable&quot;</span>
</code></pre></div></li></ol> <p><img src="/assets/img/docker2.e1e0f6da.jpg" alt="docker2"></p> <ol start="2"><li>更新国内源路径</li></ol> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token function">apt</span> update
</code></pre></div><p>3.安装查看版本指令</p> <div class="language- extra-class"><pre class="language-text"><code>apt-get install -y apt-show-versions
</code></pre></div><p>4.查看docker-ce版本号</p> <div class="language- extra-class"><pre class="language-text"><code>apt-show-versions -a docker-ce
</code></pre></div><ol start="5"><li>在线安装<code>Docker-ce</code></li></ol> <div class="language-shell extra-class"><pre class="language-shell"><code>   <span class="token function">sudo</span> <span class="token function">apt-get</span> update <span class="token operator">&amp;&amp;</span> <span class="token function">apt-get</span> <span class="token function">install</span> -y docker-ce
</code></pre></div><div class="language- extra-class"><pre><code>注意到当前安装的版本是 `docker-ce_5%3a18.09.6~3-0~ubuntu-cosmic_amd64.deb`
</code></pre></div><h3 id="_3-2-3-手动安装docker-离线安装"><a href="#_3-2-3-手动安装docker-离线安装" class="header-anchor">#</a> 3.2.3 手动安装Docker(离线安装)</h3> <ol><li>下载<code>docker-ce_18.06.1\~ce\~3-0\~ubuntu_amd64.deb</code></li> <li>上传到上述文件到待安装服务器<code>master</code></li> <li>登录待安装服务器，切换到root账户</li> <li><code>dpkg -i docker-ce_18.06.1\~ce\~3-0\~ubuntu_amd64.deb</code></li></ol> <blockquote><p>如果提示错误</p></blockquote> <div class="language-bash extra-class"><pre class="language-bash"><code>dpkg: error: dpkg frontend is locked by another process
</code></pre></div><p>说明已经有其他进程在使用dpkg安装程序</p> <div class="language- extra-class"><pre class="language-text"><code>sudo rm /var/lib/dpkg/lock
</code></pre></div><p>即可。</p> <blockquote><p>如果提示错误</p></blockquote> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~/package$ <span class="token function">sudo</span> dpkg -i docker-ce_18.06.1~ce~3-0~ubuntu_amd64.deb
 
<span class="token punctuation">[</span>sudo<span class="token punctuation">]</span> password <span class="token keyword">for</span> itcast: 
Selecting previously unselected package docker-ce.
<span class="token punctuation">(</span>Reading database <span class="token punctuation">..</span>. <span class="token number">100647</span> files and directories currently installed.<span class="token punctuation">)</span>
Preparing to unpack docker-ce_18.06.1~ce~3-0~ubuntu_amd64.deb <span class="token punctuation">..</span>.
Unpacking docker-ce <span class="token punctuation">(</span><span class="token number">18.06</span>.1~ce~3-0~ubuntu<span class="token punctuation">)</span> <span class="token punctuation">..</span>.
dpkg: dependency problems prevent configuration of docker-ce:
 docker-ce depends on libltdl7 <span class="token punctuation">(</span><span class="token operator">&gt;</span><span class="token operator">=</span> <span class="token number">2.4</span>.6<span class="token punctuation">)</span><span class="token punctuation">;</span> however:
  Package libltdl7 is not installed.

dpkg: error processing package docker-ce <span class="token punctuation">(</span>--install<span class="token punctuation">)</span>:
 dependency problems - leaving unconfigured
Processing triggers <span class="token keyword">for</span> man-db <span class="token punctuation">(</span><span class="token number">2.8</span>.4-2<span class="token punctuation">)</span> <span class="token punctuation">..</span>.
Processing triggers <span class="token keyword">for</span> systemd <span class="token punctuation">(</span><span class="token number">239</span>-7ubuntu10<span class="token punctuation">)</span> <span class="token punctuation">..</span>.
Errors were encountered <span class="token keyword">while</span> processing:
 docker-ce
</code></pre></div><p>表示当前docker-ce 依赖系统libltd17库，安装就可以了</p> <div class="language-bash extra-class"><pre class="language-bash"><code>$ <span class="token function">apt-get</span> <span class="token function">install</span> -y libltdl7
</code></pre></div><ol start="5"><li>docker version</li></ol> <div class="language-shell extra-class"><pre class="language-shell"><code>Client:
 Version:           <span class="token number">18.06</span>.1-ce
 API version:       <span class="token number">1.38</span>
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug <span class="token number">21</span> <span class="token number">17</span>:24:56 <span class="token number">2018</span>
 OS/Arch:           linux/amd64
 Experimental:      <span class="token boolean">false</span>

Server:
 Engine:
  Version:          <span class="token number">18.06</span>.1-ce
  API version:      <span class="token number">1.38</span> <span class="token punctuation">(</span>minimum version <span class="token number">1.12</span><span class="token punctuation">)</span>
  Go version:       go1.10.3
  Git commit:       e68fc7a
  Built:            Tue Aug <span class="token number">21</span> <span class="token number">17</span>:23:21 <span class="token number">2018</span>
  OS/Arch:          linux/amd64
  Experimental:     <span class="token boolean">false</span>
</code></pre></div><p>确保版本号是 <code>18.06</code></p> <h2 id="_3-3-启动docker-ce"><a href="#_3-3-启动docker-ce" class="header-anchor">#</a> 3.3 启动Docker-ce</h2> <ol><li>开机并启动docker</li></ol> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token function">sudo</span> systemctl <span class="token builtin class-name">enable</span> docker 
<span class="token function">sudo</span> systemctl start docker 
</code></pre></div><ol start="2"><li>重启，登录确认<code>docker</code>已经运行</li></ol> <div class="language-shell extra-class"><pre class="language-shell"><code>itcast@ubuntu:~$ <span class="token function">sudo</span> docker <span class="token function">ps</span> 
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
</code></pre></div><ol start="3"><li>下载<code>Alpine</code>镜像热身一下 <code>Docker</code></li></ol> <div class="language-bash extra-class"><pre class="language-bash"><code>~$ <span class="token function">sudo</span> docker run -it --rm alpine:latest <span class="token function">sh</span> 
</code></pre></div><p>输出内容如下，我们在<code>Docker</code>容器中测试三个命令，分别是</p> <div class="language-bash extra-class"><pre class="language-bash"><code>- <span class="token variable"><span class="token variable">`</span><span class="token function">date</span><span class="token variable">`</span></span>
- <span class="token variable"><span class="token variable">`</span><span class="token function">time</span><span class="token variable">`</span></span>
- <span class="token variable"><span class="token variable">`</span><span class="token function">uname</span> -r<span class="token variable">`</span></span>
</code></pre></div><div class="language-bash extra-class"><pre class="language-bash"><code>itcast@ubuntu:~$ <span class="token function">sudo</span> docker run -it --rm alpine:latest <span class="token function">sh</span> 
Unable to <span class="token function">find</span> image <span class="token string">'alpine:latest'</span> locally
latest: Pulling from library/alpine
e7c96db7181b: Pull complete 
Digest: sha256:769fddc7cc2f0a1c35abb2f91432e8beecf83916c421420e6a6da9f8975464b6
Status: Downloaded newer image <span class="token keyword">for</span> alpine:latest
/ <span class="token comment"># date</span>
Mon Jun <span class="token number">10</span> 07:56:01 UTC <span class="token number">2019</span>
/ <span class="token comment"># time</span>
BusyBox v1.29.3 <span class="token punctuation">(</span><span class="token number">2019</span>-01-24 07:45:07 UTC<span class="token punctuation">)</span> multi-call binary.

Usage: <span class="token function">time</span> <span class="token punctuation">[</span>-vpa<span class="token punctuation">]</span> <span class="token punctuation">[</span>-o FILE<span class="token punctuation">]</span> PROG ARGS

Run PROG, display resource usage when it exits

	-v	Verbose
	-p	POSIX output <span class="token function">format</span>
	-f FMT	Custom <span class="token function">format</span>
	-o FILE	Write result to FILE
	-a	Append <span class="token punctuation">(</span>else overwrite<span class="token punctuation">)</span>
/ <span class="token comment"># uname -r </span>
<span class="token number">4.18</span>.0-10-generic

</code></pre></div><p><img src="/assets/img/docker3.ad5aad6f.jpg" alt="docker3"></p> <h2 id="_3-4-创建docker用户组并添加当前用户"><a href="#_3-4-创建docker用户组并添加当前用户" class="header-anchor">#</a> 3.4 创建Docker用户组并添加当前用户</h2> <p>使用您的用户登录Linux然后执行如下操作，用户组docker可能已经存在。</p> <p>如果使用普通用户目前是无法使用docker指令的</p> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~$ docker <span class="token function">ps</span>
Got permission denied <span class="token keyword">while</span> trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.38/containers/json: dial unix /var/run/docker.sock: connect: permission denied
</code></pre></div><p>我们需要将当前的普通用户添加到当前的docker用户组中</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token function">sudo</span> <span class="token function">groupadd</span> docker
<span class="token function">sudo</span> <span class="token function">usermod</span> -aG docker <span class="token environment constant">$USER</span>
<span class="token builtin class-name">exit</span>
</code></pre></div><p>重新登录使用普通用户登录:</p> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~$ docker <span class="token function">ps</span>
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
</code></pre></div><p>就可以使用了。</p> <h2 id="_3-5-申请阿里云镜像加速器"><a href="#_3-5-申请阿里云镜像加速器" class="header-anchor">#</a> 3.5 申请阿里云镜像加速器</h2> <p>如果不申请阿里云私人专属镜像加速器，鼓励复制如下本人申请的私人专属镜像加速器，直接使用即可。</p> <div class="language-shell extra-class"><pre class="language-shell"><code>https://ozcouv1b.mirror.aliyuncs.com
</code></pre></div><p><strong>申请步骤如下</strong></p> <p>在阿里云注册自己账户</p> <p>找到<strong>容器镜像服务</strong>，参考网址如下</p> <div class="language-shell extra-class"><pre class="language-shell"><code>https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
</code></pre></div><p>点开左侧菜单<strong>镜像中心</strong>—&gt;<strong>镜像加速器</strong></p> <p>右侧加速器地址，即使私人专属的镜像加速器地址，点击<strong>复制</strong></p> <p>粘贴到一个文本文件留存</p> <p>![docker4](/Users/apple/Nustore Files/我的坚果云/课程研发/k8s/assert/docker4.jpg)</p> <hr> <h2 id="_3-6-docker配置国内镜像加速器"><a href="#_3-6-docker配置国内镜像加速器" class="header-anchor">#</a> 3.6 docker配置国内镜像加速器</h2> <blockquote><p>目的 : 为了下载docker镜像更快</p></blockquote> <p>您可以通过修改<code>daemon</code>配置文件<code>/etc/docker/daemon.json</code>来使用加速器。</p> <p>创建<code>/etc/docker/daemon.json</code>文件，内容如下：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">{</span>
  <span class="token property">&quot;registry-mirrors&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token string">&quot;https://ozcouv1b.mirror.aliyuncs.com&quot;</span><span class="token punctuation">]</span>
<span class="token punctuation">}</span>
</code></pre></div><p>重启docker服务</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token comment"># 重载所有修改过的配置文件</span>
<span class="token function">sudo</span> systemctl daemon-reload
<span class="token comment"># 重启Docker服务</span>
<span class="token function">sudo</span> systemctl restart docker
</code></pre></div><h1 id="四、kubernetes-安装及部署"><a href="#四、kubernetes-安装及部署" class="header-anchor">#</a> 四、Kubernetes 安装及部署</h1> <h2 id="_4-1-k8s安装环境准备"><a href="#_4-1-k8s安装环境准备" class="header-anchor">#</a> 4.1 k8s安装环境准备</h2> <h3 id="_4-1-1-配置并安装k8s国内源"><a href="#_4-1-1-配置并安装k8s国内源" class="header-anchor">#</a> 4.1.1 配置并安装k8s国内源</h3> <ol><li><p>创建配置文件<code>sudo touch /etc/apt/sources.list.d/kubernetes.list</code></p></li> <li><p>添加写权限</p> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~$ <span class="token function">sudo</span> <span class="token function">chmod</span> <span class="token number">666</span> /etc/apt/sources.list.d/kubernetes.list 
</code></pre></div><p>再添加，内容如下:</p> <div class="language- extra-class"><pre class="language-text"><code>deb http://mirrors.ustc.edu.cn/kubernetes/apt kubernetes-xenial main
</code></pre></div></li> <li><p>执行<code>sudo apt update</code> 更新操作系统源，开始会遇见如下错误</p> <div class="language-bash extra-class"><pre class="language-bash"><code>tcast@master:~$ <span class="token function">sudo</span> <span class="token function">apt</span> update
Get:1 http://mirrors.ustc.edu.cn/kubernetes/apt kubernetes-xenial InRelease <span class="token punctuation">[</span><span class="token number">8,993</span> B<span class="token punctuation">]</span>
Err:1 http://mirrors.ustc.edu.cn/kubernetes/apt kubernetes-xenial InRelease    
  The following signatures couldn<span class="token string">'t be verified because the public key is not available: NO_PUBKEY 6A030B21BA07F4FB
Hit:2 http://mirrors.aliyun.com/ubuntu cosmic InRelease                        
Hit:3 http://mirrors.aliyun.com/ubuntu cosmic-updates InRelease                
Hit:4 http://mirrors.aliyun.com/ubuntu cosmic-backports InRelease              
Hit:5 http://mirrors.aliyun.com/ubuntu cosmic-security InRelease               
Err:6 https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu cosmic InRelease      
  Could not wait for server fd - select (11: Resource temporarily unavailable) [IP: 202.141.176.110 443]
Reading package lists... Done                          
W: GPG error: http://mirrors.ustc.edu.cn/kubernetes/apt kubernetes-xenial InRelease: The following signatures couldn'</span>t be verified because the public key is not available: NO_PUBKEY 6A030B21BA07F4FB
E: The repository <span class="token string">'http://mirrors.ustc.edu.cn/kubernetes/apt kubernetes-xenial InRelease'</span> is not signed.
N: Updating from such a repository can't be <span class="token keyword">done</span> securely, and is therefore disabled by default.
N: See apt-secure<span class="token punctuation">(</span><span class="token number">8</span><span class="token punctuation">)</span> manpage <span class="token keyword">for</span> repository creation and user configuration details.
</code></pre></div><p>其中：</p> <div class="language-bash extra-class"><pre class="language-bash"><code>The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6A030B21BA07F4FB
</code></pre></div><p>签名认证失败，需要重新生成。记住上面的<em>NO_PUBKEY</em> <code>6A030B21BA07F4FB</code></p></li> <li><p>添加认证key</p> <p>运行如下命令，添加错误中对应的key(错误中NO_PUBKEY后面的key的后8位)</p> <div class="language-shell extra-class"><pre class="language-shell"><code>gpg --keyserver keyserver.ubuntu.com --recv-keys BA07F4FB
</code></pre></div><p>接着运行如下命令，确认看到<strong>OK</strong>，说明成功，之后进行安装:</p> <div class="language-shell extra-class"><pre class="language-shell"><code>gpg --export --armor BA07F4FB <span class="token operator">|</span> <span class="token function">sudo</span> apt-key <span class="token function">add</span> -
</code></pre></div></li> <li><p>再次重新<code>sudo apt update</code>更新系统下载源数据列表</p></li></ol> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~$ <span class="token function">sudo</span> <span class="token function">apt</span> update
Hit:1 https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu cosmic InRelease                  
Hit:2 http://mirrors.aliyun.com/ubuntu cosmic InRelease                                    
Hit:3 http://mirrors.aliyun.com/ubuntu cosmic-updates InRelease                            
Hit:4 http://mirrors.aliyun.com/ubuntu cosmic-backports InRelease                          
Hit:5 http://mirrors.aliyun.com/ubuntu cosmic-security InRelease                           
Get:6 http://mirrors.ustc.edu.cn/kubernetes/apt kubernetes-xenial InRelease <span class="token punctuation">[</span><span class="token number">8,993</span> B<span class="token punctuation">]</span>      
Ign:7 http://mirrors.ustc.edu.cn/kubernetes/apt kubernetes-xenial/main amd64 Packages
Get:7 http://mirrors.ustc.edu.cn/kubernetes/apt kubernetes-xenial/main amd64 Packages <span class="token punctuation">[</span><span class="token number">26.6</span> kB<span class="token punctuation">]</span>
Fetched <span class="token number">26.6</span> kB <span class="token keyword">in</span> 42s <span class="token punctuation">(</span><span class="token number">635</span> B/s<span class="token punctuation">)</span>    
Reading package lists<span class="token punctuation">..</span>. Done
Building dependency tree       
Reading state information<span class="token punctuation">..</span>. Done
<span class="token number">165</span> packages can be upgraded. Run <span class="token string">'apt list --upgradable'</span> to see them.
</code></pre></div><p>以上没有报和错误异常，表示成功。</p> <h3 id="_4-1-2-禁止基础设施"><a href="#_4-1-2-禁止基础设施" class="header-anchor">#</a> 4.1.2 禁止基础设施</h3> <ol><li><p>禁止防火墙</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ <span class="token function">sudo</span> ufw disable
Firewall stopped and disabled on system startup
</code></pre></div></li> <li><p>关闭swap</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token comment"># 成功</span>
$ <span class="token function">sudo</span> swapoff -a 
<span class="token comment"># 永久关闭swap分区</span>
$ <span class="token function">sudo</span> <span class="token function">sed</span> -i <span class="token string">'s/.*swap.*/#&amp;/'</span> /etc/fstab
</code></pre></div></li> <li><p>禁止selinux</p></li></ol> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token comment"># 安装操控selinux的命令</span>
$ <span class="token function">sudo</span> <span class="token function">apt</span> <span class="token function">install</span> -y selinux-utils
<span class="token comment"># 禁止selinux</span>
$ setenforce <span class="token number">0</span>
<span class="token comment"># 重启操作系统</span>
$ <span class="token function">shutdown</span> -r now
<span class="token comment"># 查看selinux是否已经关闭</span>
$ <span class="token function">sudo</span> getenforce
Disabled<span class="token punctuation">(</span>表示已经关闭<span class="token punctuation">)</span>
</code></pre></div><h2 id="_4-2-k8s系统网络配置"><a href="#_4-2-k8s系统网络配置" class="header-anchor">#</a> 4.2 k8s系统网络配置</h2> <p>(1) 配置内核参数，将桥接的IPv4流量传递到iptables的链</p> <p>创建<code>/etc/sysctl.d/k8s.conf</code>文件</p> <p>添加内容如下:</p> <div class="language-ini extra-class"><pre class="language-ini"><code><span class="token constant">net.bridge.bridge-nf-call-ip6tables</span> <span class="token attr-value"><span class="token punctuation">=</span> 1</span>
<span class="token constant">net.bridge.bridge-nf-call-iptables</span> <span class="token attr-value"><span class="token punctuation">=</span> 1</span>
<span class="token constant">vm.swappiness</span> <span class="token attr-value"><span class="token punctuation">=</span> 0</span>
</code></pre></div><p>(2) 执行命令使修改生效</p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment"># 【候选】建议执行下面的命令</span>
$ <span class="token function">sudo</span> modprobe br_netfilter
$ <span class="token function">sudo</span> sysctl -p /etc/sysctl.d/k8s.conf
</code></pre></div><h2 id="_4-3-安装k8s"><a href="#_4-3-安装k8s" class="header-anchor">#</a> 4.3 安装k8s</h2> <blockquote><p><strong>注意: 切换到root用户 <code>$ su</code></strong></p></blockquote> <ol><li><p>安装Kubernetes 目前安装版本  <code>v1.13.1</code></p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ <span class="token function">apt</span> update <span class="token operator">&amp;&amp;</span> <span class="token function">apt-get</span> <span class="token function">install</span> -y <span class="token assign-left variable">kubelet</span><span class="token operator">=</span><span class="token number">1.13</span>.1-00 kubernetes-cni<span class="token operator">=</span><span class="token number">0.6</span>.0-00 <span class="token assign-left variable">kubeadm</span><span class="token operator">=</span><span class="token number">1.13</span>.1-00 <span class="token assign-left variable">kubectl</span><span class="token operator">=</span><span class="token number">1.13</span>.1-00
</code></pre></div></li> <li><p>设置为开机重启</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ <span class="token function">sudo</span> systemctl <span class="token builtin class-name">enable</span> kubelet <span class="token operator">&amp;&amp;</span> systemctl start kubelet
$ <span class="token function">sudo</span> <span class="token function">shutdown</span> -r now
</code></pre></div></li></ol> <h2 id="_4-4-验证k8s"><a href="#_4-4-验证k8s" class="header-anchor">#</a> 4.4 验证k8s</h2> <ol><li><p>使用root用户登录<code>Master</code>主机</p></li> <li><p>执行如下个命令</p> <div class="language-shell extra-class"><pre class="language-shell"><code>kubectl get nodes 
</code></pre></div></li></ol> <p>输出如下</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ kubectl get nodes
The connection to the server localhost:8080 was refused - did you specify the right <span class="token function">host</span> or port?
</code></pre></div><ol start="3"><li><p>查看当前k8s版本</p> <div class="language-bash extra-class"><pre class="language-bash"><code>$ kubectl version
</code></pre></div></li></ol> <div class="language-bash extra-class"><pre class="language-bash"><code>Client Version: version.Info<span class="token punctuation">{</span>Major:<span class="token string">&quot;1&quot;</span>, Minor:<span class="token string">&quot;13&quot;</span>, GitVersion:<span class="token string">&quot;v1.13.1&quot;</span>, GitCommit:<span class="token string">&quot;eec55b9ba98609a46fee712359c7b5b365bdd920&quot;</span>, GitTreeState:<span class="token string">&quot;clean&quot;</span>, BuildDate:<span class="token string">&quot;2018-12-13T10:39:04Z&quot;</span>, GoVersion:<span class="token string">&quot;go1.11.2&quot;</span>, Compiler:<span class="token string">&quot;gc&quot;</span>, Platform:<span class="token string">&quot;linux/amd64&quot;</span><span class="token punctuation">}</span>
The connection to the server localhost:8080 was refused - did you specify the right <span class="token function">host</span> or port?
</code></pre></div><h1 id="五、创建企业kubernetes多主机集群环境"><a href="#五、创建企业kubernetes多主机集群环境" class="header-anchor">#</a> 五、创建企业Kubernetes多主机集群环境</h1> <h2 id="_5-1-创建两个节点-两个虚拟机"><a href="#_5-1-创建两个节点-两个虚拟机" class="header-anchor">#</a> 5.1 创建两个节点(两个虚拟机)</h2> <ol><li>在VMWare中创建完整克隆，分别命名为<code>UbuntuNode1</code>和<code>UbuntuNode2</code></li></ol> <p>![k8snode1](/Users/apple/Nustore Files/我的坚果云/课程研发/k8s/assert/k8snode1.jpg)</p> <p>分别对两个完整克隆的虚拟机进行如下操作，修改主机名称和静态IP</p> <ol><li>使用root用户登录</li> <li>打开配置文件<code>vim /etc/cloud/cloud.cfg</code></li> <li>修改配置<code>preserve_hostname: true</code></li></ol> <p>![k8snode2](/Users/apple/Nustore Files/我的坚果云/课程研发/k8s/assert/k8snode2.jpg)</p> <ol start="3"><li>修改<code>/etc/hostname</code>，只有一行 <code>node1</code>或<code>node2</code></li></ol> <h2 id="_5-2-master和node基础配置"><a href="#_5-2-master和node基础配置" class="header-anchor">#</a> 5.2 master和node基础配置</h2> <h3 id="_5-2-1-给node配置hostname"><a href="#_5-2-1-给node配置hostname" class="header-anchor">#</a> 5.2.1 给node配置hostname</h3> <p><code>node1</code>主机</p> <p>/etc/hostname</p> <div class="language-bash extra-class"><pre class="language-bash"><code>node1
</code></pre></div><p><code>node2</code>主机</p> <p>/et/hostname</p> <div class="language-bash extra-class"><pre class="language-bash"><code>node2
</code></pre></div><p>2.确认配置的三台机器的主机名称</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ <span class="token function">cat</span> /etc/hosts
$ <span class="token function">shutdown</span> -r now
</code></pre></div><h3 id="_5-2-2-配置ip地址"><a href="#_5-2-2-配置ip地址" class="header-anchor">#</a> 5.2.2 配置IP地址</h3> <ul><li>master</li></ul> <p><code>/etc/netplan/50-cloud-init.yaml</code></p> <div class="language-bash extra-class"><pre class="language-bash"><code>network:
    ethernets:
        ens33:
            addresses: <span class="token punctuation">[</span><span class="token number">192.168</span>.236.177/24<span class="token punctuation">]</span>
            dhcp4: <span class="token boolean">false</span>
            gateway4: <span class="token number">192.168</span>.236.2
            nameservers:
                       addresses: <span class="token punctuation">[</span><span class="token number">192.168</span>.236.2<span class="token punctuation">]</span>
            optional: <span class="token boolean">true</span>
    version: <span class="token number">2</span>
</code></pre></div><p>重启ip配置</p> <div class="language-bash extra-class"><pre class="language-bash"><code>netplan apply
</code></pre></div><ul><li>node1</li></ul> <p><code>/etc/netplan/50-cloud-init.yaml</code></p> <div class="language-bash extra-class"><pre class="language-bash"><code>network:
    ethernets:
        ens33:
            addresses: <span class="token punctuation">[</span><span class="token number">192.168</span>.236.178/24<span class="token punctuation">]</span>
            dhcp4: <span class="token boolean">false</span>
            gateway4: <span class="token number">192.168</span>.236.2
            nameservers:
                       addresses: <span class="token punctuation">[</span><span class="token number">192.168</span>.236.2<span class="token punctuation">]</span>
            optional: <span class="token boolean">true</span>
    version: <span class="token number">2</span>
</code></pre></div><p>重启ip配置</p> <div class="language-bash extra-class"><pre class="language-bash"><code>netplan apply
</code></pre></div><ul><li>node2</li></ul> <p><code>/etc/netplan/50-cloud-init.yaml</code></p> <div class="language-bash extra-class"><pre class="language-bash"><code>network:
    ethernets:
        ens33:
            addresses: <span class="token punctuation">[</span><span class="token number">192.168</span>.236.179/24<span class="token punctuation">]</span>
            dhcp4: <span class="token boolean">false</span>
            gateway4: <span class="token number">192.168</span>.236.2
            nameservers:
                       addresses: <span class="token punctuation">[</span><span class="token number">192.168</span>.236.2<span class="token punctuation">]</span>
            optional: <span class="token boolean">true</span>
    version: <span class="token number">2</span>
</code></pre></div><p>重启ip配置</p> <div class="language-bash extra-class"><pre class="language-bash"><code>netplan apply
</code></pre></div><h3 id="_5-2-3-修改hosts文件"><a href="#_5-2-3-修改hosts文件" class="header-anchor">#</a> 5.2.3 修改hosts文件</h3> <p>注意： (Master、Node1、Node2都需要配置)</p> <p>使用root用户登录</p> <ol><li><p>打开hosts文件 <code>vim /etc/hosts</code></p></li> <li><p>输入如下内容</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token number">192.168</span>.236.177 master
<span class="token number">192.168</span>.236.178 node1
<span class="token number">192.168</span>.236.179 node2
</code></pre></div></li> <li><p>重启机器<code>shutdown -r now</code></p></li></ol> <h2 id="_5-3-配置master节点"><a href="#_5-3-配置master节点" class="header-anchor">#</a> 5.3 配置Master节点</h2> <h3 id="_5-3-1-创建工作目录"><a href="#_5-3-1-创建工作目录" class="header-anchor">#</a> 5.3.1 创建工作目录</h3> <div class="language-shell extra-class"><pre class="language-shell"><code>$ <span class="token function">mkdir</span> /home/itcast/working
$ <span class="token builtin class-name">cd</span> /home/itcast/working/
</code></pre></div><h3 id="_5-3-2-创建kubeadm-conf配置文件"><a href="#_5-3-2-创建kubeadm-conf配置文件" class="header-anchor">#</a> 5.3.2 创建kubeadm.conf配置文件</h3> <ol><li>创建k8s的管理工具<code>kubeadm</code>对应的配置文件，候选操作在<code>home/itcast/working/</code>目录下</li></ol> <p>使用kubeadm配置文件，通过在配置文件中指定docker仓库地址，便于内网快速部署。</p> <p>生成配置文件</p> <div class="language- extra-class"><pre class="language-text"><code>kubeadm config print init-defaults ClusterConfiguration &gt; kubeadm.conf
</code></pre></div><ol start="2"><li>修改<code>kubeadm.conf</code>中的如下两项:</li></ol> <ul><li>imageRepository</li> <li>kubernetesVersion</li></ul> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">vi</span> kubeadm.conf
<span class="token comment"># 修改 imageRepository: k8s.gcr.io</span>
<span class="token comment"># 改为 registry.cn-beijing.aliyuncs.com/imcto</span>
imageRepository: registry.cn-beijing.aliyuncs.com/imcto
<span class="token comment"># 修改kubernetes版本kubernetesVersion: v1.13.0</span>
<span class="token comment"># 改为kubernetesVersion: v1.13.1</span>
kubernetesVersion: v1.13.1
</code></pre></div><ol start="3"><li>修改<code>kubeadm.conf</code>中的API服务器地址，后面会频繁使用这个地址。</li></ol> <ul><li>localAPIEndpoint:</li></ul> <div class="language-shell extra-class"><pre class="language-shell"><code>localAPIEndpoint:
  advertiseAddress: <span class="token number">192.168</span>.236.177
  bindPort: <span class="token number">6443</span>
</code></pre></div><blockquote><p>注意: <code>192.168.236.177</code>是master主机的ip地址</p></blockquote> <ol start="4"><li>配置子网网络</li></ol> <div class="language-ini extra-class"><pre class="language-ini"><code>networking:
  dnsDomain: cluster.local
  podSubnet: 10.244.0.0/16
  serviceSubnet: 10.96.0.0/12
scheduler: {}
</code></pre></div><p>这里的<code>10.244.0.0/16</code> 和 <code>10.96.0.0/12</code>分别是k8s内部pods和services的子网网络，最好使用这个地址，后续flannel网络需要用到。</p> <h3 id="_5-3-3-拉取k8s必备的模块镜像"><a href="#_5-3-3-拉取k8s必备的模块镜像" class="header-anchor">#</a> 5.3.3 拉取K8s必备的模块镜像</h3> <ol><li>查看一下都需要哪些镜像文件需要拉取</li></ol> <div class="language- extra-class"><pre class="language-text"><code>$ kubeadm config images list --config kubeadm.conf
registry.cn-beijing.aliyuncs.com/imcto/kube-apiserver:v1.13.1
registry.cn-beijing.aliyuncs.com/imcto/kube-controller-manager:v1.13.1
registry.cn-beijing.aliyuncs.com/imcto/kube-scheduler:v1.13.1
registry.cn-beijing.aliyuncs.com/imcto/kube-proxy:v1.13.1
registry.cn-beijing.aliyuncs.com/imcto/pause:3.1
registry.cn-beijing.aliyuncs.com/imcto/etcd:3.2.24
registry.cn-beijing.aliyuncs.com/imcto/coredns:1.2.6
</code></pre></div><ol start="2"><li>拉取镜像</li></ol> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment">#下载全部当前版本的k8s所关联的镜像</span>
kubeadm config images pull --config ./kubeadm.conf
</code></pre></div><h3 id="_5-3-4-初始化kubernetes环境"><a href="#_5-3-4-初始化kubernetes环境" class="header-anchor">#</a> 5.3.4 初始化kubernetes环境</h3> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment">#初始化并且启动</span>
$ <span class="token function">sudo</span> kubeadm init --config ./kubeadm.conf
</code></pre></div><p>更多kubeadm配置文件参数详见</p> <div class="language- extra-class"><pre class="language-text"><code>kubeadm config print-defaults
</code></pre></div><p><strong>k8s启动成功输出内容较多，但是记住末尾的内容</strong></p> <div class="language-shell extra-class"><pre class="language-shell"><code>Your Kubernetes master has initialized successfully<span class="token operator">!</span>

To start using your cluster, you need to run the following as a regular user:

  <span class="token function">mkdir</span> -p <span class="token environment constant">$HOME</span>/.kube
  <span class="token function">sudo</span> <span class="token function">cp</span> -i /etc/kubernetes/admin.conf <span class="token environment constant">$HOME</span>/.kube/config
  <span class="token function">sudo</span> <span class="token function">chown</span> <span class="token variable"><span class="token variable">$(</span><span class="token function">id</span> -u<span class="token variable">)</span></span><span class="token builtin class-name">:</span><span class="token variable"><span class="token variable">$(</span><span class="token function">id</span> -g<span class="token variable">)</span></span> <span class="token environment constant">$HOME</span>/.kube/config

You should now deploy a pod network to the cluster.
Run <span class="token string">&quot;kubectl apply -f [podnetwork].yaml&quot;</span> with one of the options listed at:
  https://kubernetes.io/docs/concepts/cluster-administration/addons/

You can now <span class="token function">join</span> any number of machines by running the following on each node
as root:

  kubeadm <span class="token function">join</span> <span class="token number">192.168</span>.236.177:6443 --token abcdef.0123456789abcdef --discovery-token-ca-cert-hash sha256:e778d3665e52f5a680a87b00c6d54df726c2eda601c0db3bfa4bb198af2262a8
</code></pre></div><p>按照官方提示，执行以下操作。</p> <ol><li><p>执行如下命令</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ <span class="token function">mkdir</span> -p <span class="token environment constant">$HOME</span>/.kube
$ <span class="token function">sudo</span> <span class="token function">cp</span> -i /etc/kubernetes/admin.conf <span class="token environment constant">$HOME</span>/.kube/config
$ <span class="token function">sudo</span> <span class="token function">chown</span> <span class="token variable"><span class="token variable">$(</span><span class="token function">id</span> -u<span class="token variable">)</span></span><span class="token builtin class-name">:</span><span class="token variable"><span class="token variable">$(</span><span class="token function">id</span> -g<span class="token variable">)</span></span> <span class="token environment constant">$HOME</span>/.kube/config
</code></pre></div></li> <li><p>创建系统服务并启动</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token comment"># 启动kubelet 设置为开机自启动</span>
$ <span class="token function">sudo</span> systemctl <span class="token builtin class-name">enable</span> kubelet
<span class="token comment"># 启动k8s服务程序</span>
$ <span class="token function">sudo</span> systemctl start kubelet
</code></pre></div></li></ol> <h3 id="_5-3-5-验证kubernetes启动结果"><a href="#_5-3-5-验证kubernetes启动结果" class="header-anchor">#</a> 5.3.5 验证kubernetes启动结果</h3> <ol><li>验证输入，注意显示master状态是<code>NotReady</code>，证明初始化服务器成功</li></ol> <div class="language-shell extra-class"><pre class="language-shell"><code>$ kubectl get nodes
NAME     STATUS     ROLES    AGE   VERSION
master   NotReady   master   12m   v1.13.1
</code></pre></div><ol start="2"><li>查看当前k8s集群状态</li></ol> <div class="language-shell extra-class"><pre class="language-shell"><code>$ kubectl get cs
NAME                 STATUS    MESSAGE              ERROR
scheduler            Healthy   ok
controller-manager   Healthy   ok
etcd-0               Healthy   <span class="token punctuation">{</span><span class="token string">&quot;health&quot;</span><span class="token builtin class-name">:</span> <span class="token string">&quot;true&quot;</span><span class="token punctuation">}</span>
</code></pre></div><p>目前只有一个master，还没有node，而且是NotReady状态，那么我们需要将node加入到master管理的集群中来。在加入之前，我们需要先配置k8s集群的内部通信网络，这里采用的是flannel网络。</p> <h3 id="_5-3-6-部署集群内部通信flannel网络"><a href="#_5-3-6-部署集群内部通信flannel网络" class="header-anchor">#</a> 5.3.6 部署集群内部通信flannel网络</h3> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token variable">$cd</span> <span class="token environment constant">$HOME</span>/working
<span class="token variable">$wget</span> https://raw.githubusercontent.com/coreos/flannel/a70459be0084506e4ec919aa1c114638878db11b/Documentation/kube-flannel.yml
</code></pre></div><p>编辑这个文件，确保flannel网络是对的,找到<code>net-conf.json</code>标记的内容是否正确。</p> <div class="language-ini extra-class"><pre class="language-ini"><code> net-conf.json: |
    {
      &quot;Network&quot;: &quot;10.244.0.0/16&quot;,
      &quot;Backend&quot;: {
        &quot;Type&quot;: &quot;vxlan&quot;
      }
</code></pre></div><p><strong>这个&quot;10.244.0.0/16&quot;和 ./kubeadm.conf中的podsubnet的地址要一致。</strong></p> <p>应用当前flannel配置文件</p> <div class="language-shell extra-class"><pre class="language-shell"><code>itcast@master:~/working$ kubectl apply -f kube-flannel.yml 
</code></pre></div><p>输出结果如下</p> <div class="language-shell extra-class"><pre class="language-shell"><code>root@master:~/working<span class="token comment"># kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/a70459be0084506e4ec919aa1c114638878db11b/Documentation/kube-flannel.yml</span>
clusterrole.rbac.authorization.k8s.io/flannel created
clusterrolebinding.rbac.authorization.k8s.io/flannel created
serviceaccount/flannel created
configmap/kube-flannel-cfg created
daemonset.extensions/kube-flannel-ds-amd64 created
daemonset.extensions/kube-flannel-ds-arm64 created
daemonset.extensions/kube-flannel-ds-arm created
daemonset.extensions/kube-flannel-ds-ppc64le created
daemonset.extensions/kube-flannel-ds-s390x created
</code></pre></div><p>安装flannel网络前 执行<code>kubectl get nodes</code>输出结果如下</p> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~/working$ kubectl get node
NAME     STATUS     ROLES    AGE   VERSION
master   NotReady   master   10m   v1.13.1
</code></pre></div><p>安装flannel网络后 执行<code>kubectl get nodes</code>输出结果如下</p> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~/working$ kubectl get node
NAME     STATUS   ROLES    AGE   VERSION
master   Ready    master   10m   v1.13.1
</code></pre></div><p>此时master已经是<code>Ready</code>状态了，表示已经配置成功了，那么我们就需要配置node来加入这个集群。</p> <h2 id="_5-4-配置node"><a href="#_5-4-配置node" class="header-anchor">#</a> 5.4 配置Node</h2> <h3 id="_5-4-1-确认外部环境"><a href="#_5-4-1-确认外部环境" class="header-anchor">#</a> 5.4.1 确认外部环境</h3> <ol><li><p>确认关闭swap</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token function">apt</span> <span class="token function">install</span> -y selinux-utils
swapoff -a
</code></pre></div></li> <li><p>禁止selinux</p> <div class="language-shell extra-class"><pre class="language-shell"><code>setenforce <span class="token number">0</span>
</code></pre></div></li> <li><p>确认关闭防火墙</p> <div class="language-shell extra-class"><pre class="language-shell"><code>ufw disable
</code></pre></div></li></ol> <h3 id="_5-4-2-配置k8s集群的node主机环境"><a href="#_5-4-2-配置k8s集群的node主机环境" class="header-anchor">#</a> 5.4.2 配置k8s集群的Node主机环境</h3> <ol><li><p>启动k8s后台服务</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token comment"># 启动kubelet 设置为开机自启动</span>
$ <span class="token function">sudo</span> systemctl <span class="token builtin class-name">enable</span> kubelet
<span class="token comment"># 启动k8s服务程序</span>
$ <span class="token function">sudo</span> systemctl start kubelet
</code></pre></div></li> <li><p>将master机器的<code>/etc/kubernetes/admin.conf</code>传到到node1和node2</p> <p>登录<code>master</code>终端</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token comment">#将admin.conf传递给node1</span>
<span class="token function">sudo</span> <span class="token function">scp</span> /etc/kubernetes/admin.conf itcast@192.168.236.178:/home/itcast/
<span class="token comment">#将admin.conf传递给node2</span>
<span class="token function">sudo</span> <span class="token function">scp</span> /etc/kubernetes/admin.conf itcast@192.168.236.179:/home/itcast/
</code></pre></div></li> <li><p>登录<code>node1</code>终端，创建基础kube配置文件环境</p></li></ol> <div class="language-bash extra-class"><pre class="language-bash"><code>$ <span class="token function">mkdir</span> -p <span class="token environment constant">$HOME</span>/.kube
$ <span class="token function">sudo</span> <span class="token function">cp</span> -i <span class="token environment constant">$HOME</span>/admin.conf <span class="token environment constant">$HOME</span>/.kube/config
$ <span class="token function">sudo</span> <span class="token function">chown</span> <span class="token variable"><span class="token variable">$(</span><span class="token function">id</span> -u<span class="token variable">)</span></span><span class="token builtin class-name">:</span><span class="token variable"><span class="token variable">$(</span><span class="token function">id</span> -g<span class="token variable">)</span></span> <span class="token environment constant">$HOME</span>/.kube/config
</code></pre></div><ol start="4"><li>登录<code>node2</code>终端，创建基础kube配置文件环境</li></ol> <div class="language-bash extra-class"><pre class="language-bash"><code>$ <span class="token function">mkdir</span> -p <span class="token environment constant">$HOME</span>/.kube
$ <span class="token function">sudo</span> <span class="token function">cp</span> -i <span class="token environment constant">$HOME</span>/admin.conf <span class="token environment constant">$HOME</span>/.kube/config
$ <span class="token function">sudo</span> <span class="token function">chown</span> <span class="token variable"><span class="token variable">$(</span><span class="token function">id</span> -u<span class="token variable">)</span></span><span class="token builtin class-name">:</span><span class="token variable"><span class="token variable">$(</span><span class="token function">id</span> -g<span class="token variable">)</span></span> <span class="token environment constant">$HOME</span>/.kube/config
</code></pre></div><ol start="5"><li><code>node1</code>和<code>node2</code>分别连接<code>master</code>加入master集群。这里用的是<code>kubeadm join</code>指令</li></ol> <div class="language-shell extra-class"><pre class="language-shell"><code>$ <span class="token function">sudo</span> kubeadm <span class="token function">join</span> <span class="token number">192.168</span>.236.177:6443 --token abcdef.0123456789abcdef --discovery-token-ca-cert-hash sha256:e778d3665e52f5a680a87b00c6d54df726c2eda601c0db3bfa4bb198af2262a8
</code></pre></div><p>这里要注意，使用的hash应该是<code>master</code>主机 <code>kubeadm init</code>成功之后生成的hash码。</p> <ol start="6"><li>应用两个node主机分别应用flannel网络</li></ol> <p>将<code>master</code>中的<code>kube-flannel.yml</code>分别传递给两个<code>node</code>节点.</p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment">#将kube-flannel.yml传递给node1</span>
<span class="token function">sudo</span> <span class="token function">scp</span> <span class="token environment constant">$HOME</span>/working/kube-flannel.yml itcast@192.168.236.178:/home/itcast/
<span class="token comment">#将kube-flannel.yml传递给node2</span>
<span class="token function">sudo</span> <span class="token function">scp</span> <span class="token environment constant">$HOME</span>/working/kube-flannel.yml itcast@192.168.236.179:/home/itcast/
</code></pre></div><p>分别启动<code>flannel</code>网络</p> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@node1:~$ kubectl apply -f kube-flannel.yml 
</code></pre></div><div class="language-bash extra-class"><pre class="language-bash"><code>itcast@node2:~$ kubectl apply -f kube-flannel.yml
</code></pre></div><ol start="7"><li>查看node是否已经加入到k8s集群中(需要等一段时间才能ready)</li></ol> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@node2:~$ kubectl get nodes
NAME     STATUS   ROLES    AGE     VERSION
master   Ready    master   35m     v1.13.1
node1    Ready    <span class="token operator">&lt;</span>none<span class="token operator">&gt;</span>   2m23s   v1.13.1
node2    Ready    <span class="token operator">&lt;</span>none<span class="token operator">&gt;</span>   40s     v1.13.1
</code></pre></div><h1 id="六、应用实例"><a href="#六、应用实例" class="header-anchor">#</a> 六、应用实例</h1> <h2 id="_6-1-创建mysql实例"><a href="#_6-1-创建mysql实例" class="header-anchor">#</a> 6.1 创建MySQL实例</h2> <h3 id="_6-1-1-定义描述文件"><a href="#_6-1-1-定义描述文件" class="header-anchor">#</a> 6.1.1 定义描述文件</h3> <div class="language-yaml extra-class"><pre class="language-yaml"><code><span class="token key atrule">apiVersion</span><span class="token punctuation">:</span> v1
<span class="token key atrule">kind</span><span class="token punctuation">:</span> ReplicationController                            <span class="token comment">#副本控制器RC</span>
<span class="token key atrule">metadata</span><span class="token punctuation">:</span>
  <span class="token key atrule">name</span><span class="token punctuation">:</span> mysql                                          <span class="token comment">#RC的名称，全局唯一</span>
<span class="token key atrule">spec</span><span class="token punctuation">:</span>
  <span class="token key atrule">replicas</span><span class="token punctuation">:</span> <span class="token number">1</span>                                          <span class="token comment">#Pod副本的期待数量</span>
  <span class="token key atrule">selector</span><span class="token punctuation">:</span>
    <span class="token key atrule">app</span><span class="token punctuation">:</span> mysql                                         <span class="token comment">#符合目标的Pod拥有此标签</span>
  <span class="token key atrule">template</span><span class="token punctuation">:</span>                                            <span class="token comment">#根据此模板创建Pod的副本（实例）</span>
    <span class="token key atrule">metadata</span><span class="token punctuation">:</span>
      <span class="token key atrule">labels</span><span class="token punctuation">:</span>
        <span class="token key atrule">app</span><span class="token punctuation">:</span> mysql                                     <span class="token comment">#Pod副本拥有的标签，对应RC的Selector</span>
    <span class="token key atrule">spec</span><span class="token punctuation">:</span>
      <span class="token key atrule">containers</span><span class="token punctuation">:</span>                                      <span class="token comment">#Pod内容器的定义部分</span>
      <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> mysql                                    <span class="token comment">#容器的名称</span>
        <span class="token key atrule">image</span><span class="token punctuation">:</span> hub.c.163.com/library/mysql              <span class="token comment">#容器对应的Docker image</span>
        <span class="token key atrule">ports</span><span class="token punctuation">:</span> 
        <span class="token punctuation">-</span> <span class="token key atrule">containerPort</span><span class="token punctuation">:</span> <span class="token number">3306</span>                          <span class="token comment">#容器应用监听的端口号</span>
          <span class="token key atrule">targetPort</span><span class="token punctuation">:</span> <span class="token number">3306</span>
        <span class="token key atrule">env</span><span class="token punctuation">:</span>                                           <span class="token comment">#注入容器内的环境变量</span>
        <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> MYSQL_ROOT_PASSWORD 
          <span class="token key atrule">value</span><span class="token punctuation">:</span> <span class="token string">&quot;123456&quot;</span>
</code></pre></div><h3 id="_6-1-2-加载replicationcontroller副本控制器描述文件"><a href="#_6-1-2-加载replicationcontroller副本控制器描述文件" class="header-anchor">#</a> 6.1.2 加载ReplicationController副本控制器描述文件</h3> <p>创建好mysql-rc.yaml后，在master节点使用kubectl命令将它发布到k8s集群中。</p> <div class="language-shell extra-class"><pre class="language-shell"><code>kubectl create -f mysql-rc.yaml
</code></pre></div><h3 id="_6-1-3-查看启动状态"><a href="#_6-1-3-查看启动状态" class="header-anchor">#</a> 6.1.3 查看启动状态</h3> <p>通过查看当前的<code>pods</code>列表，是否已经启动成功:</p> <h3 id="_6-1-4-网络异常解决方案-未出现问题可直接跳过"><a href="#_6-1-4-网络异常解决方案-未出现问题可直接跳过" class="header-anchor">#</a> 6.1.4 网络异常解决方案(未出现问题可直接跳过)</h3> <p>注意：如果这里出现了<code>ContainerCreating</code>状态，那么可以尝试如下解决办法:</p> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~/working$ kubectl get pods
NAME          READY   STATUS              RESTARTS   AGE
mysql-tscrh   <span class="token number">0</span>/1     ContainerCreating   <span class="token number">0</span>          17m
</code></pre></div><p>目前mysql-tscrh 描述文件 已经创建，但是没有启动成功. 状态是<code>ContainerCreating</code> 没有启动起来.</p> <p>通过<code>kubectl describe pods</code>来查看<code>pods</code>的详细状态</p> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~/working$ kubectl describe pods mysql
Name:               mysql-tscrh
Namespace:          default
Priority:           <span class="token number">0</span>
PriorityClassName:  <span class="token operator">&lt;</span>none<span class="token operator">&gt;</span>
Node:               node1/192.168.236.178
Start Time:         Mon, <span class="token number">17</span> Jun <span class="token number">2019</span> 09:10:35 +0000
Labels:             <span class="token assign-left variable">app</span><span class="token operator">=</span>mysql
Annotations:        <span class="token operator">&lt;</span>none<span class="token operator">&gt;</span>
Status:             Pending
IP:                 
Controlled By:      ReplicationController/mysql
Containers:
  mysql:
    Container ID:   
    Image:          hub.c.163.com/library/mysql
    Image ID:       
    Port:           <span class="token number">3306</span>/TCP
    Host Port:      <span class="token number">0</span>/TCP
    State:          Waiting
      Reason:       ContainerCreating
    Ready:          False
    Restart Count:  <span class="token number">0</span>
    Environment:
      MYSQL_ROOT_PASSWORD:  <span class="token number">123456</span>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-q6ggq <span class="token punctuation">(</span>ro<span class="token punctuation">)</span>
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  default-token-q6ggq:
    Type:        Secret <span class="token punctuation">(</span>a volume populated by a Secret<span class="token punctuation">)</span>
    SecretName:  default-token-q6ggq
    Optional:    <span class="token boolean">false</span>
QoS Class:       BestEffort
Node-Selectors:  <span class="token operator">&lt;</span>none<span class="token operator">&gt;</span>
Tolerations:     node.kubernetes.io/not-ready:NoExecute <span class="token keyword">for</span> 300s
                 node.kubernetes.io/unreachable:NoExecute <span class="token keyword">for</span> 300s
Events:
  Type     Reason                  Age                     From               Message
  ----     ------                  ----                    ----               -------
  Normal   Scheduled               22m                     default-scheduler  Successfully assigned default/mysql-tscrh to node1
  Warning  FailedCreatePodSandBox  22m                     kubelet, node1     Failed create pod sandbox: rpc error: code <span class="token operator">=</span> Unknown desc <span class="token operator">=</span> failed to <span class="token builtin class-name">set</span> up sandbox container <span class="token string">&quot;58d143373e767c40610587624c667d8e20dd77fa397952406a085f2ae1dc38e6&quot;</span> network <span class="token keyword">for</span> pod <span class="token string">&quot;mysql-tscrh&quot;</span><span class="token builtin class-name">:</span> NetworkPlugin cni failed to <span class="token builtin class-name">set</span> up pod <span class="token string">&quot;mysql-tscrh_default&quot;</span> network: <span class="token function">open</span> /run/flannel/subnet.env: no such <span class="token function">file</span> or directory
  Warning  FailedCreatePodSandBox  22m                     kubelet, node1     Failed create pod sandbox: rpc error: code <span class="token operator">=</span> Unknown desc <span class="token operator">=</span> failed to <span class="token builtin class-name">set</span> up sandbox container <span class="token string">&quot;81d12726dbe075c64af48142638e98863231e8201ccc292f0dda1fccfa7fdaec&quot;</span> network <span class="token keyword">for</span> pod <span class="token string">&quot;mysql-tscrh&quot;</span><span class="token builtin class-name">:</span> NetworkPlugin cni failed to <span class="token builtin class-name">set</span> up pod <span class="token string">&quot;mysql-tscrh_default&quot;</span> network: <span class="token function">open</span> /run/flannel/subnet.env: no such <span class="token function">file</span> or directory
  Warning  FailedCreatePodSandBox  22m                     kubelet, node1     Failed create pod sandbox: rpc error: code <span class="token operator">=</span> Unknown desc <span class="token operator">=</span> failed to <span class="token builtin class-name">set</span> up sandbox container <span class="token string">&quot;8bd77ee0176d369435ead7bd3c2675b7bbcbdc2b052cf34c784f04053a7d5288&quot;</span> network <span class="token keyword">for</span> pod <span class="token string">&quot;mysql-tscrh&quot;</span><span class="token builtin class-name">:</span> NetworkPlugin cni failed to <span class="token builtin class-name">set</span> up pod <span class="token string">&quot;mysql-tscrh_default&quot;</span> network: <span class="token function">open</span> /run/flannel/subnet.env: no such <span class="token function">file</span> or directory
  Warning  FailedCreatePodSandBox  22m                     kubelet, node1     Failed create pod sandbox: rpc error: code <span class="token operator">=</span> Unknown desc <span class="token operator">=</span> failed to <span class="token builtin class-name">set</span> up sandbox container <span class="token string">&quot;0733fc209e085e96f5823a2280b012a609dace41fda967c5ae951005a8699ce6&quot;</span> network <span class="token keyword">for</span> pod <span class="token string">&quot;mysql-tscrh&quot;</span><span class="token builtin class-name">:</span> NetworkPlugin cni failed to <span class="token builtin class-name">set</span> up pod <span class="token string">&quot;mysql-tscrh_default&quot;</span> network: <span class="token function">open</span> /run/flannel/subnet.env: no such <span class="token function">file</span> or directory
  Warning  FailedCreatePodSandBox  22m                     kubelet, node1     Failed create pod sandbox: rpc error: code <span class="token operator">=</span> Unknown desc <span class="token operator">=</span> failed to <span class="token builtin class-name">set</span> up sandbox container <span class="token string">&quot;91f337eb334612b2e7426d820ba4b15a9c9c549050517d459508832b69780b5f&quot;</span> network <span class="token keyword">for</span> pod <span class="token string">&quot;mysql-tscrh&quot;</span><span class="token builtin class-name">:</span> NetworkPlugin cni failed to <span class="token builtin class-name">set</span> up pod <span class="token string">&quot;mysql-tscrh_default&quot;</span> network: <span class="token function">open</span> /run/flannel/subnet.env: no such <span class="token function">file</span> or directory
  Warning  FailedCreatePodSandBox  22m                     kubelet, node1     Failed create pod sandbox: rpc error: code <span class="token operator">=</span> Unknown desc <span class="token operator">=</span> failed to <span class="token builtin class-name">set</span> up sandbox container <span class="token string">&quot;48cbba9896068a774d9128a6864394e8726a0d857bae61036421ad73f5d6e3dd&quot;</span> network <span class="token keyword">for</span> pod <span class="token string">&quot;mysql-tscrh&quot;</span><span class="token builtin class-name">:</span> NetworkPlugin cni failed to <span class="token builtin class-name">set</span> up pod <span class="token string">&quot;mysql-tscrh_default&quot;</span> network: <span class="token function">open</span> /run/flannel/subnet.env: no such <span class="token function">file</span> or directory
  Warning  FailedCreatePodSandBox  22m                     kubelet, node1     Failed create pod sandbox: rpc error: code <span class="token operator">=</span> Unknown desc <span class="token operator">=</span> failed to <span class="token builtin class-name">set</span> up sandbox container <span class="token string">&quot;d259778aa19418a9a429b3175b66afae3d8ffb7324ec9df492b2947dbc153460&quot;</span> network <span class="token keyword">for</span> pod <span class="token string">&quot;mysql-tscrh&quot;</span><span class="token builtin class-name">:</span> NetworkPlugin cni failed to <span class="token builtin class-name">set</span> up pod <span class="token string">&quot;mysql-tscrh_default&quot;</span> network: <span class="token function">open</span> /run/flannel/subnet.env: no such <span class="token function">file</span> or directory
  Warning  FailedCreatePodSandBox  22m                     kubelet, node1     Failed create pod sandbox: rpc error: code <span class="token operator">=</span> Unknown desc <span class="token operator">=</span> failed to <span class="token builtin class-name">set</span> up sandbox container <span class="token string">&quot;3d01c00ac9eaac7b2e983402be38c1cf60c4bbd1d454aa45329ce0ca0c2bf792&quot;</span> network <span class="token keyword">for</span> pod <span class="token string">&quot;mysql-tscrh&quot;</span><span class="token builtin class-name">:</span> NetworkPlugin cni failed to <span class="token builtin class-name">set</span> up pod <span class="token string">&quot;mysql-tscrh_default&quot;</span> network: <span class="token function">open</span> /run/flannel/subnet.env: no such <span class="token function">file</span> or directory
  Warning  FailedCreatePodSandBox  22m                     kubelet, node1     Failed create pod sandbox: rpc error: code <span class="token operator">=</span> Unknown desc <span class="token operator">=</span> failed to <span class="token builtin class-name">set</span> up sandbox container <span class="token string">&quot;98879cbb0405dac3a24753dd1986070a53fe9ee9f1b819996a903c19286a2bb7&quot;</span> network <span class="token keyword">for</span> pod <span class="token string">&quot;mysql-tscrh&quot;</span><span class="token builtin class-name">:</span> NetworkPlugin cni failed to <span class="token builtin class-name">set</span> up pod <span class="token string">&quot;mysql-tscrh_default&quot;</span> network: <span class="token function">open</span> /run/flannel/subnet.env: no such <span class="token function">file</span> or directory
  Warning  FailedCreatePodSandBox  7m49s <span class="token punctuation">(</span>x838 over 22m<span class="token punctuation">)</span>   kubelet, node1     <span class="token punctuation">(</span>combined from similar events<span class="token punctuation">)</span>: Failed create pod sandbox: rpc error: code <span class="token operator">=</span> Unknown desc <span class="token operator">=</span> failed to <span class="token builtin class-name">set</span> up sandbox container <span class="token string">&quot;60923335b41c2d0412b279bdb6150f9b9b7eae20c4a02549e35509083c01384b&quot;</span> network <span class="token keyword">for</span> pod <span class="token string">&quot;mysql-tscrh&quot;</span><span class="token builtin class-name">:</span> NetworkPlugin cni failed to <span class="token builtin class-name">set</span> up pod <span class="token string">&quot;mysql-tscrh_default&quot;</span> network: <span class="token function">open</span> /run/flannel/subnet.env: no such <span class="token function">file</span> or directory
  Normal   SandboxChanged          2m49s <span class="token punctuation">(</span>x1127 over 22m<span class="token punctuation">)</span>  kubelet, node1     Pod sandbox changed, it will be killed and re-created.
</code></pre></div><p>会看到一个错误:</p> <div class="language- extra-class"><pre class="language-text"><code>&quot;mysql-tscrh&quot;: NetworkPlugin cni failed to set up pod &quot;mysql-tscrh_default&quot; network: open /run/flannel/subnet.env: no such file or directory
</code></pre></div><p>这是缺少/run/flannel/subnet.env文件</p> <h5 id="解决办法：配置flannel网络"><a href="#解决办法：配置flannel网络" class="header-anchor">#</a> 解决办法：配置flannel网络</h5> <p>分别在三台服务器上执行如下步骤</p> <ol><li><p>创建目录</p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">sudo</span> <span class="token function">mkdir</span> -p /run/flannel
</code></pre></div></li> <li><p>创建环境描述文件</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ <span class="token function">sudo</span> <span class="token function">tee</span> /run/flannel/subnet.env <span class="token operator">&lt;&lt;-</span><span class="token string">'EOF'
FLANNEL_NETWORK=10.244.0.0/16
FLANNEL_SUBNET=10.244.0.1/24
FLANNEL_MTU=1450
FLANNEL_IPMASQ=true
EOF</span>
</code></pre></div></li></ol> <h3 id="_6-1-5-查看mysql实例集群状态"><a href="#_6-1-5-查看mysql实例集群状态" class="header-anchor">#</a> 6.1.5 查看mysql实例集群状态</h3> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~/working$ kubectl get pods
NAME          READY   STATUS              RESTARTS   AGE
mysql-tscrh   <span class="token number">0</span>/1     Running   <span class="token number">0</span>          17m
</code></pre></div><p>如果为<code>Running</code>状态，则为mysql集群启动成功。</p> <h2 id="_6-2-创建tomcat实例"><a href="#_6-2-创建tomcat实例" class="header-anchor">#</a> 6.2 创建Tomcat实例</h2> <h3 id="_6-2-1-定义描述文件"><a href="#_6-2-1-定义描述文件" class="header-anchor">#</a> 6.2.1 定义描述文件</h3> <div class="language-yaml extra-class"><pre class="language-yaml"><code><span class="token key atrule">apiVersion</span><span class="token punctuation">:</span> v1
<span class="token key atrule">kind</span><span class="token punctuation">:</span> ReplicationController
<span class="token key atrule">metadata</span><span class="token punctuation">:</span>
  <span class="token key atrule">name</span><span class="token punctuation">:</span> myweb
<span class="token key atrule">spec</span><span class="token punctuation">:</span>
  <span class="token key atrule">replicas</span><span class="token punctuation">:</span> <span class="token number">5</span>                                       <span class="token comment">#Pod副本期待数量为5</span>
  <span class="token key atrule">selector</span><span class="token punctuation">:</span>
    <span class="token key atrule">app</span><span class="token punctuation">:</span> myweb
  <span class="token key atrule">template</span><span class="token punctuation">:</span>
    <span class="token key atrule">metadata</span><span class="token punctuation">:</span>
      <span class="token key atrule">labels</span><span class="token punctuation">:</span>
        <span class="token key atrule">app</span><span class="token punctuation">:</span> myweb
    <span class="token key atrule">spec</span><span class="token punctuation">:</span>
      <span class="token key atrule">containers</span><span class="token punctuation">:</span>
      <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> myweb
        <span class="token key atrule">image</span><span class="token punctuation">:</span> docker.io/kubeguide/tomcat<span class="token punctuation">-</span>app<span class="token punctuation">:</span>v1
        <span class="token key atrule">ports</span><span class="token punctuation">:</span> 
        <span class="token punctuation">-</span> <span class="token key atrule">containerPort</span><span class="token punctuation">:</span> <span class="token number">8080</span>
        <span class="token key atrule">env</span><span class="token punctuation">:</span>
        <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> MYSQL_SERVICE_HOST
          <span class="token key atrule">value</span><span class="token punctuation">:</span> <span class="token string">&quot;mysql&quot;</span>
        <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> MYSQL_SERVICE_PORT
          <span class="token key atrule">value</span><span class="token punctuation">:</span> <span class="token string">&quot;3306&quot;</span>
</code></pre></div><h3 id="_6-2-2-加载rc副本描述文件"><a href="#_6-2-2-加载rc副本描述文件" class="header-anchor">#</a> 6.2.2 加载RC副本描述文件</h3> <div class="language-shell extra-class"><pre class="language-shell"><code>$ kubectl create -f myweb-rc.yaml
replicationcontroller/myweb created
$ kubectl get rc
NAME    DESIRED   CURRENT   READY   AGE
mysql   <span class="token number">1</span>         <span class="token number">1</span>         <span class="token number">0</span>       4m22s
myweb   <span class="token number">5</span>         <span class="token number">5</span>         <span class="token number">0</span>       7s
$ kubectl get pods
NAME          READY   STATUS              RESTARTS   AGE
mysql-tp69s   <span class="token number">1</span>/1     Running             <span class="token number">0</span>          21s
myweb-266mz   <span class="token number">0</span>/1     ContainerCreating   <span class="token number">0</span>          2s
myweb-j7nl7   <span class="token number">0</span>/1     ContainerCreating   <span class="token number">0</span>          2s
myweb-s7drm   <span class="token number">0</span>/1     ContainerCreating   <span class="token number">0</span>          2s
myweb-sq4ns   <span class="token number">0</span>/1     ContainerCreating   <span class="token number">0</span>          2s
myweb-t4vlf   <span class="token number">0</span>/1     ContainerCreating   <span class="token number">0</span>          2s
$ 
</code></pre></div><p>注意mysql实例 状态 <code>Running</code></p> <p>myweb实例状态 <code>ContainerCreating</code></p> <p>过几分钟myweb实例状态变成 <code>Running</code></p> <h3 id="_6-2-3-创建服务副本"><a href="#_6-2-3-创建服务副本" class="header-anchor">#</a> 6.2.3 创建服务副本</h3> <p>在master服务器</p> <ol><li>使用root用户登录，并切换到working目录 <code>cd /root/working</code></li> <li>创建描述服务描述文件<code>myweb-svc.yaml</code></li></ol> <div class="language-yaml extra-class"><pre class="language-yaml"><code><span class="token key atrule">apiVersion</span><span class="token punctuation">:</span> v1
<span class="token key atrule">kind</span><span class="token punctuation">:</span> Service
<span class="token key atrule">metadata</span><span class="token punctuation">:</span>
  <span class="token key atrule">name</span><span class="token punctuation">:</span> myweb
<span class="token key atrule">spec</span><span class="token punctuation">:</span>
  <span class="token key atrule">type</span><span class="token punctuation">:</span> NodePort
  <span class="token key atrule">ports</span><span class="token punctuation">:</span>
    <span class="token punctuation">-</span> <span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">8080</span>
      <span class="token key atrule">nodePort</span><span class="token punctuation">:</span> <span class="token number">30001</span>
  <span class="token key atrule">selector</span><span class="token punctuation">:</span>
    <span class="token key atrule">app</span><span class="token punctuation">:</span> myweb 
</code></pre></div><h3 id="_6-2-4-部署服务"><a href="#_6-2-4-部署服务" class="header-anchor">#</a> 6.2.4 部署服务</h3> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token variable">$kubectl</span> create -f myweb-svc.yaml
</code></pre></div><h3 id="_6-2-5-验证"><a href="#_6-2-5-验证" class="header-anchor">#</a> 6.2.5 验证</h3> <div class="language-shell extra-class"><pre class="language-shell"><code>$ kubectl get pods
NAME          READY   STATUS    RESTARTS   AGE
mysql-tp69s   <span class="token number">1</span>/1     Running   <span class="token number">0</span>          15m
myweb-266mz   <span class="token number">1</span>/1     Running   <span class="token number">0</span>          14m
myweb-j7nl7   <span class="token number">1</span>/1     Running   <span class="token number">0</span>          14m
myweb-s7drm   <span class="token number">1</span>/1     Running   <span class="token number">0</span>          14m
myweb-sq4ns   <span class="token number">1</span>/1     Running   <span class="token number">0</span>          14m
myweb-t4vlf   <span class="token number">1</span>/1     Running   <span class="token number">0</span>          14m
</code></pre></div><div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~/working$ kubectl get <span class="token function">service</span>     
NAME         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT<span class="token punctuation">(</span>S<span class="token punctuation">)</span>          AGE
kubernetes   ClusterIP   <span class="token number">10.96</span>.0.1        <span class="token operator">&lt;</span>none<span class="token operator">&gt;</span>        <span class="token number">443</span>/TCP          19h
myweb        NodePort    <span class="token number">10.109</span>.234.197   <span class="token operator">&lt;</span>none<span class="token operator">&gt;</span>        <span class="token number">8080</span>:30001/TCP   25m
</code></pre></div><p>已经看到已经有一个<code>myweb</code>服务已经启动</p> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~/working$ kubectl describe <span class="token function">service</span> myweb
Name:                     myweb
Namespace:                default
Labels:                   <span class="token operator">&lt;</span>none<span class="token operator">&gt;</span>
Annotations:              <span class="token operator">&lt;</span>none<span class="token operator">&gt;</span>
Selector:                 <span class="token assign-left variable">app</span><span class="token operator">=</span>myweb
Type:                     NodePort
IP:                       <span class="token number">10.109</span>.234.197
Port:                     <span class="token operator">&lt;</span>unset<span class="token operator">&gt;</span>  <span class="token number">8080</span>/TCP
TargetPort:               <span class="token number">8080</span>/TCP
NodePort:                 <span class="token operator">&lt;</span>unset<span class="token operator">&gt;</span>  <span class="token number">30001</span>/TCP
Endpoints:                <span class="token number">10.244</span>.0.6:8080,10.244.0.6:8080,10.244.0.7:8080 + <span class="token number">2</span> more<span class="token punctuation">..</span>.
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <span class="token operator">&lt;</span>none<span class="token operator">&gt;</span>
</code></pre></div><p>service详情这里的IP就是CLUSTER-IP. CLUSTER-IP是和service绑定的。</p> <p>service详情这里的Port就是Service的端口号。</p> <p>service详情这里的NodePort就是Node的真实端口号。</p> <p>service详情这里的Endpoints就是容器的IP和port。</p> <p>验证端口号</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ <span class="token function">netstat</span> -tlp<span class="token operator">|</span><span class="token function">grep</span> <span class="token number">30001</span>
tcp6       <span class="token number">0</span>      <span class="token number">0</span> <span class="token punctuation">[</span>::<span class="token punctuation">]</span>:30001              <span class="token punctuation">[</span>::<span class="token punctuation">]</span>:*                  LISTEN      <span class="token number">4333</span>/kube-proxy
$
</code></pre></div><p>我们可以打开浏览器，输入master/node1/node2任何一个地址家30001端口都可以，访问tomcat服务。</p> <div class="language- extra-class"><pre class="language-text"><code>http://192.168.236.177:30001
</code></pre></div><h2 id="_6-3-创建自定义的beego-应用web程序集群"><a href="#_6-3-创建自定义的beego-应用web程序集群" class="header-anchor">#</a> 6.3 创建自定义的Beego 应用web程序集群</h2> <h3 id="_6-3-1-初始化mysql"><a href="#_6-3-1-初始化mysql" class="header-anchor">#</a> 6.3.1 初始化mysql</h3> <ol><li>找到我们之前创建好的mysql的pod的<code>NAME</code></li></ol> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~$ kubectl get pods
NAME          READY   STATUS    RESTARTS   AGE
mysql-kjdz8   <span class="token number">1</span>/1     Running   <span class="token number">2</span>          4d23h
myweb-f7rt4   <span class="token number">1</span>/1     Running   <span class="token number">2</span>          4d23h
myweb-jjxbp   <span class="token number">1</span>/1     Running   <span class="token number">2</span>          4d23h
myweb-k8rmt   <span class="token number">1</span>/1     Running   <span class="token number">2</span>          4d23h
myweb-rht8n   <span class="token number">1</span>/1     Running   <span class="token number">2</span>          4d23h
myweb-wsgzw   <span class="token number">1</span>/1     Running   <span class="token number">2</span>          4d23h
</code></pre></div><ol start="2"><li>查看当前pod的详细信息</li></ol> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~$ kubectl describe pod mysql-kjdz8

</code></pre></div><ol start="3"><li>得到mysql在subnet内网的IP地址<code>10.244.1.8</code>  和登录密码</li></ol> <div class="language-bash extra-class"><pre class="language-bash"><code>IP:                 <span class="token number">10.244</span>.1.8 
 <span class="token punctuation">..</span>.
 Environment:
      MYSQL_ROOT_PASSWORD:  <span class="token number">123456</span>
</code></pre></div><ol start="4"><li>登录mysql实例，创建数据库</li></ol> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~$ kubectl <span class="token builtin class-name">exec</span> -it mysql-kjdz8 -- <span class="token function">bash</span>
</code></pre></div><div class="language-bash extra-class"><pre class="language-bash"><code>root@mysql-kjdz8:/<span class="token comment"># mysql -u root --password=123456 --default-character-set=utf8     </span>
</code></pre></div><ol start="5"><li>创建数据库，注意大小写</li></ol> <div class="language-sql extra-class"><pre class="language-sql"><code><span class="token keyword">CREATE</span> <span class="token keyword">DATABASE</span> <span class="token keyword">IF</span> <span class="token operator">NOT</span> <span class="token keyword">EXISTS</span> newsWeb  <span class="token keyword">default</span> <span class="token keyword">charset</span> utf8 <span class="token keyword">COLLATE</span> utf8_general_ci<span class="token punctuation">;</span>
</code></pre></div><ol start="6"><li>使用数据库</li></ol> <div class="language-sql extra-class"><pre class="language-sql"><code><span class="token keyword">use</span> newsWeb
</code></pre></div><h3 id="_6-3-2-下载自定义的beego-docker-镜像"><a href="#_6-3-2-下载自定义的beego-docker-镜像" class="header-anchor">#</a> 6.3.2 下载自定义的beego-docker 镜像</h3> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~$ docker pull registry.cn-shanghai.aliyuncs.com/itcast-golang/beego-microservices:v4
921b31ab772b: Pull complete 
5dbef71438d6: Pull complete 
06b82a06d476: Pull complete 
903fde8a2004: Pull complete 
5102aca51d1d: Pull complete 
b0ebda6ce096: Pull complete 
1a243f1cae73: Pull complete 
Digest: sha256:7b83e5117d964f348750de76104d6302285410365aaf6e6a0d4f57edab7a0ad5
Status: Downloaded newer image <span class="token keyword">for</span> registry.cn-shanghai.aliyuncs.com/itcast-golang/beego-microservices:v4
</code></pre></div><p>当然，目前该镜像地址是我们自己打包的，如果你想启动你自己的镜像应用，也需要打包成docker镜像放在阿里云或者其他docker仓库中。</p> <p>查看docker镜像是否已经下载成功。</p> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~$ docker images
REPOSITORY                                                            TAG                 IMAGE ID            CREATED             SIZE
registry.cn-shanghai.aliyuncs.com/itcast-golang/beego-microservices   v4                  11f6f974f78b        <span class="token number">35</span> minutes ago      <span class="token number">23</span>.1MB
alpine                                                                latest              055936d39205        <span class="token number">6</span> weeks ago         <span class="token number">5</span>.53MB
registry.cn-beijing.aliyuncs.com/imcto/kube-controller-manager        v1.13.1             6ca952430d0a        <span class="token number">3</span> months ago        146MB
registry.cn-beijing.aliyuncs.com/imcto/kube-proxy                     v1.13.1             a311f9763fcc        <span class="token number">3</span> months ago        <span class="token number">80</span>.2MB
registry.cn-beijing.aliyuncs.com/imcto/coredns                        <span class="token number">1.2</span>.6               782ac1267b76        <span class="token number">3</span> months ago        40MB
registry.cn-beijing.aliyuncs.com/imcto/etcd                           <span class="token number">3.2</span>.24              399cf402bfe9        <span class="token number">3</span> months ago        220MB
registry.cn-beijing.aliyuncs.com/imcto/pause                          <span class="token number">3.1</span>                 73ae15a7a613        <span class="token number">3</span> months ago        742kB
registry.cn-beijing.aliyuncs.com/imcto/kube-scheduler                 v1.13.1             4b8df70aff4e        <span class="token number">3</span> months ago        <span class="token number">79</span>.6MB
registry.cn-beijing.aliyuncs.com/imcto/kube-apiserver                 v1.13.1             06924f18fe15        <span class="token number">3</span> months ago        181MB
quay.io/coreos/flannel                                                v0.11.0-amd64       ff281650a721        <span class="token number">4</span> months ago        <span class="token number">52</span>.6MB
</code></pre></div><h3 id="_6-3-3-创建beego的rc副本文件"><a href="#_6-3-3-创建beego的rc副本文件" class="header-anchor">#</a> 6.3.3 创建beego的RC副本文件</h3> <div class="language-yaml extra-class"><pre class="language-yaml"><code><span class="token key atrule">apiVersion</span><span class="token punctuation">:</span> v1
<span class="token key atrule">kind</span><span class="token punctuation">:</span> ReplicationController
<span class="token key atrule">metadata</span><span class="token punctuation">:</span>
  <span class="token key atrule">name</span><span class="token punctuation">:</span> beego
<span class="token key atrule">spec</span><span class="token punctuation">:</span>
  <span class="token key atrule">replicas</span><span class="token punctuation">:</span> <span class="token number">5</span>                                       <span class="token comment">#Pod副本期待数量为5</span>
  <span class="token key atrule">selector</span><span class="token punctuation">:</span>
    <span class="token key atrule">app</span><span class="token punctuation">:</span> beego
  <span class="token key atrule">template</span><span class="token punctuation">:</span>
    <span class="token key atrule">metadata</span><span class="token punctuation">:</span>
      <span class="token key atrule">labels</span><span class="token punctuation">:</span>
        <span class="token key atrule">app</span><span class="token punctuation">:</span> beego
    <span class="token key atrule">spec</span><span class="token punctuation">:</span>
      <span class="token key atrule">containers</span><span class="token punctuation">:</span>
      <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> beego
        <span class="token key atrule">image</span><span class="token punctuation">:</span> registry.cn<span class="token punctuation">-</span>shanghai.aliyuncs.com/itcast<span class="token punctuation">-</span>golang/beego<span class="token punctuation">-</span>microservices<span class="token punctuation">:</span>v4
        <span class="token key atrule">ports</span><span class="token punctuation">:</span>
        <span class="token punctuation">-</span> <span class="token key atrule">containerPort</span><span class="token punctuation">:</span> <span class="token number">8080</span>
        <span class="token key atrule">env</span><span class="token punctuation">:</span>
        <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> MYSQL_SERVICE_HOST
          <span class="token key atrule">value</span><span class="token punctuation">:</span> <span class="token string">&quot;10.244.1.8&quot;</span>
        <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> MYSQL_SERVICE_PORT
          <span class="token key atrule">value</span><span class="token punctuation">:</span> <span class="token string">&quot;3306&quot;</span>
        <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> MYSQL_SERVICE_USER
          <span class="token key atrule">value</span><span class="token punctuation">:</span> <span class="token string">&quot;root&quot;</span>
        <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> MYSQL_SERVICE_PASSWORD
          <span class="token key atrule">value</span><span class="token punctuation">:</span> <span class="token string">&quot;123456&quot;</span>
        <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> MYSQL_SERVICE_DATABASE
          <span class="token key atrule">value</span><span class="token punctuation">:</span> <span class="token string">&quot;newsWeb&quot;</span>
<span class="token punctuation">---</span>
<span class="token key atrule">apiVersion</span><span class="token punctuation">:</span> v1
<span class="token key atrule">kind</span><span class="token punctuation">:</span> Service
<span class="token key atrule">metadata</span><span class="token punctuation">:</span>
  <span class="token key atrule">name</span><span class="token punctuation">:</span> beego
<span class="token key atrule">spec</span><span class="token punctuation">:</span>
  <span class="token key atrule">type</span><span class="token punctuation">:</span> NodePort
  <span class="token key atrule">ports</span><span class="token punctuation">:</span>
    <span class="token punctuation">-</span> <span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">8080</span>
      <span class="token key atrule">nodePort</span><span class="token punctuation">:</span> <span class="token number">30080</span>
  <span class="token key atrule">selector</span><span class="token punctuation">:</span>
    <span class="token key atrule">app</span><span class="token punctuation">:</span> beego
~               
</code></pre></div><p>这里要注意，里面的mysql环境变量IP、端口、数据库用户名密码等，都是我们上面实例获取到的。</p> <p>这里实际上是在我们创建一个pods容器的时候，指定的一些环境变量。然后beego的应用程序会从系统中这些环境变量去取数据。</p> <p>目前建立了NodePort端口映射，beegoWeb应用在内网的端口是8080，对外的映射端口是30080.那么30080就是我们外网可以访问的端口号。</p> <h3 id="_6-3-4-装载rc副本文件，创建beego集群实例"><a href="#_6-3-4-装载rc副本文件，创建beego集群实例" class="header-anchor">#</a> 6.3.4 装载RC副本文件，创建beego集群实例</h3> <div class="language-shell extra-class"><pre class="language-shell"><code>$ kubectl apply -f golang-beego.yaml
</code></pre></div><p>查看beego的web程序pods是否已经正常启动</p> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~/working$ kubectl get pods
NAME          READY   STATUS    RESTARTS   AGE
beego-2wt7s   <span class="token number">1</span>/1     Running   <span class="token number">0</span>          2m47s
beego-6jp8x   <span class="token number">1</span>/1     Running   <span class="token number">0</span>          2m47s
beego-7bkvl   <span class="token number">1</span>/1     Running   <span class="token number">0</span>          2m47s
beego-qjldn   <span class="token number">1</span>/1     Running   <span class="token number">0</span>          2m47s
beego-vldmh   <span class="token number">1</span>/1     Running   <span class="token number">0</span>          2m47s
mysql-kjdz8   <span class="token number">1</span>/1     Running   <span class="token number">2</span>          5d
myweb-f7rt4   <span class="token number">1</span>/1     Running   <span class="token number">2</span>          5d
myweb-jjxbp   <span class="token number">1</span>/1     Running   <span class="token number">2</span>          5d
myweb-k8rmt   <span class="token number">1</span>/1     Running   <span class="token number">2</span>          5d
myweb-rht8n   <span class="token number">1</span>/1     Running   <span class="token number">2</span>          5d
myweb-wsgzw   <span class="token number">1</span>/1     Running   <span class="token number">2</span>          5d
</code></pre></div><p>也可以查看beego程序的pods的正常输出日志</p> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~/working$ kubectl log beego-2wt7s     
log is DEPRECATED and will be removed <span class="token keyword">in</span> a future version. Use logs instead.
<span class="token number">2019</span>/06/24 09:19:12 root:123456@tcp<span class="token punctuation">(</span><span class="token number">10.244</span>.1.8:3306<span class="token punctuation">)</span>/newsWeb?charset<span class="token operator">=</span>utf8
table <span class="token variable"><span class="token variable">`</span>user<span class="token variable">`</span></span> already exists, skip
table <span class="token variable"><span class="token variable">`</span>article<span class="token variable">`</span></span> already exists, skip
table <span class="token variable"><span class="token variable">`</span>article_type<span class="token variable">`</span></span> already exists, skip
table <span class="token variable"><span class="token variable">`</span>article_users<span class="token variable">`</span></span> already exists, skip
<span class="token number">2019</span>/06/24 09:19:12.241 <span class="token punctuation">[</span>I<span class="token punctuation">]</span> <span class="token punctuation">[</span>asm_amd64.s:1337<span class="token punctuation">]</span>  http server Running on http://:8080
</code></pre></div><p>进入其中一个beego容器，查看环境变量是否和我们配置的一致</p> <div class="language-bash extra-class"><pre class="language-bash"><code>itcast@master:~/working$ kubectl  <span class="token builtin class-name">exec</span> -it beego-2wt7s -- <span class="token function">sh</span>
/app <span class="token comment"># env</span>
<span class="token assign-left variable">KUBERNETES_SERVICE_PORT</span><span class="token operator">=</span><span class="token number">443</span>
<span class="token assign-left variable">KUBERNETES_PORT</span><span class="token operator">=</span>tcp://10.96.0.1:443
<span class="token assign-left variable">BEEGO_PORT_8080_TCP</span><span class="token operator">=</span>tcp://10.107.31.251:8080
<span class="token assign-left variable"><span class="token environment constant">HOSTNAME</span></span><span class="token operator">=</span>beego-2wt7s
<span class="token assign-left variable">MYWEB_SERVICE_HOST</span><span class="token operator">=</span><span class="token number">10.106</span>.98.4
<span class="token assign-left variable">MYWEB_PORT_8080_TCP_ADDR</span><span class="token operator">=</span><span class="token number">10.106</span>.98.4
<span class="token assign-left variable"><span class="token environment constant">SHLVL</span></span><span class="token operator">=</span><span class="token number">1</span>
<span class="token assign-left variable"><span class="token environment constant">HOME</span></span><span class="token operator">=</span>/root
<span class="token assign-left variable">MYWEB_PORT_8080_TCP_PORT</span><span class="token operator">=</span><span class="token number">8080</span>
<span class="token assign-left variable">MYWEB_PORT_8080_TCP_PROTO</span><span class="token operator">=</span>tcp
<span class="token assign-left variable">MYWEB_SERVICE_PORT</span><span class="token operator">=</span><span class="token number">8080</span>
<span class="token assign-left variable">MYWEB_PORT</span><span class="token operator">=</span>tcp://10.106.98.4:8080
<span class="token assign-left variable">MYWEB_PORT_8080_TCP</span><span class="token operator">=</span>tcp://10.106.98.4:8080
<span class="token assign-left variable"><span class="token environment constant">TERM</span></span><span class="token operator">=</span>xterm
<span class="token assign-left variable">KUBERNETES_PORT_443_TCP_ADDR</span><span class="token operator">=</span><span class="token number">10.96</span>.0.1
<span class="token assign-left variable">MYSQL_SERVICE_PASSWORD</span><span class="token operator">=</span><span class="token number">123456</span>
<span class="token assign-left variable"><span class="token environment constant">PATH</span></span><span class="token operator">=</span>/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
<span class="token assign-left variable">KUBERNETES_PORT_443_TCP_PORT</span><span class="token operator">=</span><span class="token number">443</span>
<span class="token assign-left variable">MYSQL_SERVICE_HOST</span><span class="token operator">=</span><span class="token number">10.244</span>.1.8
<span class="token assign-left variable">KUBERNETES_PORT_443_TCP_PROTO</span><span class="token operator">=</span>tcp
<span class="token assign-left variable">MYSQL_SERVICE_USER</span><span class="token operator">=</span>root
<span class="token assign-left variable">BEEGO_SERVICE_HOST</span><span class="token operator">=</span><span class="token number">10.107</span>.31.251
<span class="token assign-left variable">BEEGO_PORT_8080_TCP_ADDR</span><span class="token operator">=</span><span class="token number">10.107</span>.31.251
<span class="token assign-left variable">MYSQL_SERVICE_PORT</span><span class="token operator">=</span><span class="token number">3306</span>
<span class="token assign-left variable">KUBERNETES_SERVICE_PORT_HTTPS</span><span class="token operator">=</span><span class="token number">443</span>
<span class="token assign-left variable">KUBERNETES_PORT_443_TCP</span><span class="token operator">=</span>tcp://10.96.0.1:443
<span class="token assign-left variable">BEEGO_PORT_8080_TCP_PORT</span><span class="token operator">=</span><span class="token number">8080</span>
<span class="token assign-left variable">KUBERNETES_SERVICE_HOST</span><span class="token operator">=</span><span class="token number">10.96</span>.0.1
<span class="token assign-left variable">BEEGO_PORT_8080_TCP_PROTO</span><span class="token operator">=</span>tcp
<span class="token assign-left variable"><span class="token environment constant">PWD</span></span><span class="token operator">=</span>/app
<span class="token assign-left variable">MYSQL_SERVICE_DATABASE</span><span class="token operator">=</span>newsWeb
<span class="token assign-left variable">BEEGO_PORT</span><span class="token operator">=</span>tcp://10.107.31.251:8080
<span class="token assign-left variable">BEEGO_SERVICE_PORT</span><span class="token operator">=</span><span class="token number">8080</span>
/app <span class="token comment"># env | grep MYSQL</span>
<span class="token assign-left variable">MYSQL_SERVICE_PASSWORD</span><span class="token operator">=</span><span class="token number">123456</span>
<span class="token assign-left variable">MYSQL_SERVICE_HOST</span><span class="token operator">=</span><span class="token number">10.244</span>.1.8
<span class="token assign-left variable">MYSQL_SERVICE_USER</span><span class="token operator">=</span>root
<span class="token assign-left variable">MYSQL_SERVICE_PORT</span><span class="token operator">=</span><span class="token number">3306</span>
<span class="token assign-left variable">MYSQL_SERVICE_DATABASE</span><span class="token operator">=</span>newsWeb
</code></pre></div><h3 id="_6-3-5-验证集群是否成功"><a href="#_6-3-5-验证集群是否成功" class="header-anchor">#</a> 6.3.5 验证集群是否成功</h3> <ul><li>注册界面</li></ul> <p><a href="http://192.168.236.177:30080/register" target="_blank" rel="noopener noreferrer">http://192.168.236.177:30080/register<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></p> <p><img src="/assets/img/beego2.41411ab9.png" alt="image-20190624195413483"></p> <ul><li>登陆界面</li></ul> <p><a href="http://192.168.236.177:30080/login" target="_blank" rel="noopener noreferrer">http://192.168.236.177:30080/login<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></p> <p><img src="/assets/img/beego3.6c6bd2f2.png" alt="image-20190624195450072"></p> <ul><li>后端界面</li></ul> <p><img src="/assets/img/beego1.f66caca6.png" alt="image-20190624175022369"></p> <h1 id="七、k8s架构图"><a href="#七、k8s架构图" class="header-anchor">#</a> 七、k8s架构图</h1> <p><img src="/assets/img/architecture.7786145a.png" alt="k8s"></p></div> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">10/10/2020, 1:27:41 AM</span></div></footer> <!----> </main></div><div class="global-ui"></div></div>
    <script src="/assets/js/app.cb35c8f6.js" defer></script><script src="/assets/js/2.063846a6.js" defer></script><script src="/assets/js/4.1ffb4609.js" defer></script><script src="/assets/js/3.76257eb7.js" defer></script>
  </body>
</html>
